27#include "ns3/qos-txop.h"
28#include "ns3/wifi-acknowledgment.h"
29#include "ns3/wifi-mac-trailer.h"
30#include "ns3/wifi-protection.h"
43 TypeId(
"ns3::MultiUserScheduler")
46 .AddAttribute(
"AccessReqInterval",
47 "Duration of the interval between two consecutive requests for "
48 "channel access made by the MultiUserScheduler. Such requests are "
49 "made independently of the presence of frames in the queues of the "
50 "AP and are intended to allow the AP to coordinate UL MU transmissions "
51 "even without DL traffic. A null duration indicates that such "
52 "requests shall not be made.",
56 .AddAttribute(
"AccessReqAc",
57 "The Access Category for which the MultiUserScheduler makes requests "
58 "for channel access.",
69 .AddAttribute(
"DelayAccessReqUponAccess",
70 "If enabled, the access request interval is measured starting "
71 "from the last time an EDCA function obtained channel access. "
72 "Otherwise, the access request interval is measured starting "
73 "from the last time the MultiUserScheduler made a request for "
152 "MultiUserScheduler can only be installed on HE APs");
158 heFem->SetMultiUserScheduler(
this);
202 uint16_t allowedWidth,
205 NS_LOG_FUNCTION(
this << edca << availableTime << initialFrame << allowedWidth << linkId);
237 if (txFormat !=
NO_TX)
254 "Next transmission is not DL MU");
256#ifdef NS3_BUILD_PROFILE_DEBUG
260 auto receiver = psdu.second->GetAddr1();
262 NS_ABORT_MSG_IF(!linkId,
"Station " << receiver <<
" should be associated");
264 "Station " << psdu.second->GetAddr1() <<
" does not support HE");
275 "Next transmission is not UL MU");
286 packet->AddHeader(trigger);
291 auto aid = trigger.
begin()->GetAid12();
294 receiver = aidAddrMapIt->second;
303 return Create<WifiMpdu>(packet, hdr);
324 uint8_t maxNTids = 0;
325 for (
const auto& userInfo : trigger)
328 NS_ASSERT_MSG(address,
"AID " << userInfo.GetAid12() <<
" not found");
330 uint8_t staNTids = 0;
331 for (uint8_t tid = 0; tid < 8; tid++)
338 maxNTids = std::max(maxNTids, staNTids);
348 for (uint8_t i = 0; i < maxNTids; i++)
const std::map< uint16_t, Mac48Address > & GetStaList(uint8_t linkId) const
Get a const reference to the map of associated stations on the given link.
std::optional< Mac48Address > GetMldOrLinkAddressByAid(uint16_t aid) const
std::optional< uint8_t > IsAssociated(const Mac48Address &address) const
Get the ID of a link (if any) that has been setup with the station having the given MAC address.
AttributeValue implementation for Boolean.
void RequestAccess(Ptr< Txop > txop)
Hold variables of type enum.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
static Mac48Address GetBroadcast()
static uint32_t GetSizeIfAggregated(uint32_t mpduSize, uint32_t ampduSize)
Compute the size of the A-MPDU resulting from the aggregation of an MPDU of size mpduSize and an A-MP...
bool m_initialFrame
true if a TXOP is being started
void NotifyNewAggregate() override
Notify all Objects aggregated to this one of a new Object being aggregated.
~MultiUserScheduler() override
void DoInitialize() override
Initialize() implementation.
void AccessReqTimeout()
Perform actions required on expiration of the channel access request timer, such as requesting channe...
TxFormat GetLastTxFormat(uint8_t linkId)
Get the format of the last transmission on the given link, as determined by the last call to NotifyAc...
Ptr< ApWifiMac > m_apMac
the AP wifi MAC
void CheckTriggerFrame()
Ensure that the Trigger Frame returned in case of UL MU transmission is correct.
static TypeId GetTypeId()
Get the type ID.
uint16_t m_allowedWidth
the allowed width in MHz for the current transmission
Time m_availableTime
the time available for frame exchange
EventId m_accessReqTimer
the timer controlling additional channel access requests
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId) const
Get the station manager attached to the AP on the given link.
UlMuInfo & GetUlMuInfo(uint8_t linkId)
Get the information required to solicit an UL MU transmission on the given link.
uint8_t m_linkId
the ID of the link over which channel access has been granted
virtual TxFormat SelectTxFormat()=0
Select the format of the next transmission.
void SetAccessReqInterval(Time interval)
Set the duration of the interval between two consecutive requests for channel access made by the Mult...
TxFormat NotifyAccessGranted(Ptr< QosTxop > edca, Time availableTime, bool initialFrame, uint16_t allowedWidth, uint8_t linkId)
Notify the Multi-user Scheduler that the given AC of the AP gained channel access.
uint32_t GetMaxSizeOfQosNullAmpdu(const CtrlTriggerHeader &trigger) const
Get the maximum size in bytes among the A-MPDUs containing QoS Null frames and solicited by the given...
bool m_restartTimerUponAccess
whether the channel access timer has to be restarted upon channel access
virtual DlMuInfo ComputeDlMuInfo()=0
Compute the information required to perform a DL MU transmission.
Ptr< QosTxop > m_edca
the AC that gained channel access
virtual UlMuInfo ComputeUlMuInfo()=0
Prepare the information required to solicit an UL MU transmission.
void DoDispose() override
Destructor implementation.
Ptr< WifiMpdu > GetTriggerFrame(const CtrlTriggerHeader &trigger, uint8_t linkId) const
Get an MPDU containing the given Trigger Frame.
AcIndex m_accessReqAc
AC we request channel access for.
DlMuInfo & GetDlMuInfo(uint8_t linkId)
Get the information required to perform a DL MU transmission on the given link.
Ptr< HeFrameExchangeManager > GetHeFem(uint8_t linkId) const
Get the HE Frame Exchange Manager attached to the AP on the given link.
Time m_accessReqInterval
duration of the interval between channel access requests
void SetWifiMac(Ptr< ApWifiMac > mac)
Set the wifi MAC.
TxFormat
Enumeration of the possible transmission formats.
std::map< uint8_t, LastTxInfo > m_lastTxInfo
Information about the last transmission.
A base class which provides memory management and object aggregation.
virtual void NotifyNewAggregate()
Notify all Objects aggregated to this one of a new Object being aggregated.
virtual void DoDispose()
Destructor implementation.
bool IsInitialized() const
Check if the object has been initialized.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
AttributeValue implementation for Time.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
Ptr< HeConfiguration > GetHeConfiguration() const
uint8_t GetNLinks() const
Get the number of links (can be greater than 1 for 11be devices only).
RecipientAgreementOptConstRef GetBaAgreementEstablishedAsRecipient(Mac48Address originator, uint8_t tid) const
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Ptr< ChannelAccessManager > GetChannelAccessManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Channel Access Manager associated with the given link.
bool GetHeSupported() const
Return whether the device has HE capability support enabled.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Ptr< const AttributeChecker > MakeBooleanChecker()
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octets of the IEEE 802.11 MAC FCS field.
Ptr< const AttributeChecker > MakeEnumChecker(int v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Information to be provided in case of DL MU transmission.
Information to be provided in case of UL MU transmission.