A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
multi-user-scheduler.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#ifndef MULTI_USER_SCHEDULER_H
10#define MULTI_USER_SCHEDULER_H
11
12#include "he-ru.h"
13
14#include "ns3/ap-wifi-mac.h"
15#include "ns3/ctrl-headers.h"
16#include "ns3/object.h"
17#include "ns3/wifi-remote-station-manager.h"
18#include "ns3/wifi-tx-parameters.h"
19
20#include <unordered_map>
21#include <vector>
22
23namespace ns3
24{
25
26class HeFrameExchangeManager;
27
28typedef std::unordered_map<uint16_t /* staId */, Ptr<WifiPsdu> /* PSDU */> WifiPsduMap;
29
30/**
31 * \ingroup wifi
32 *
33 * MultiUserScheduler is an abstract base class defining the API that APs
34 * supporting at least VHT can use to determine the format of their next transmission.
35 * VHT APs can only transmit DL MU PPDUs by using MU-MIMO, while HE APs can
36 * transmit both DL MU PPDUs and UL MU PPDUs by using OFDMA in addition to MU-MIMO.
37 *
38 * However, given that DL MU-MIMO is not yet supported, a MultiUserScheduler can
39 * only be aggregated to HE APs.
40 */
42{
43 public:
44 /**
45 * \brief Get the type ID.
46 * \return the object TypeId
47 */
48 static TypeId GetTypeId();
50 ~MultiUserScheduler() override;
51
52 /// Enumeration of the possible transmission formats
60
61 /// Information to be provided in case of DL MU transmission
62 struct DlMuInfo
63 {
64 WifiPsduMap psduMap; //!< the DL MU PPDU to transmit
65 WifiTxParameters txParams; //!< the transmission parameters
66 };
67
68 /// Information to be provided in case of UL MU transmission
69 struct UlMuInfo
70 {
71 CtrlTriggerHeader trigger; //!< the Trigger Frame used to solicit TB PPDUs
72 WifiMacHeader macHdr; //!< the MAC header for the Trigger Frame
73 WifiTxParameters txParams; //!< the transmission parameters for the Trigger Frame
74 };
75
76 /**
77 * Notify the Multi-user Scheduler that the given AC of the AP gained channel
78 * access. The Multi-user Scheduler determines the format of the next transmission.
79 *
80 * \param edca the EDCAF which has been granted the opportunity to transmit
81 * \param availableTime the amount of time allowed for the frame exchange. Pass
82 * Time::Min() in case the TXOP limit is null
83 * \param initialFrame true if the frame being transmitted is the initial frame
84 * of the TXOP. This is used to determine whether the TXOP
85 * limit can be exceeded
86 * \param allowedWidth the allowed width for the next transmission
87 * \param linkId the ID of the link over which channel access was gained
88 * \return the format of the next transmission
89 */
91 Time availableTime,
92 bool initialFrame,
93 MHz_u allowedWidth,
94 uint8_t linkId);
95
96 /**
97 * Get the information required to perform a DL MU transmission on the given link. Note
98 * that this method can only be called if GetTxFormat returns DL_MU_TX on the given link.
99 *
100 * \param linkId the ID of the given link
101 * \return the information required to perform a DL MU transmission
102 */
103 DlMuInfo& GetDlMuInfo(uint8_t linkId);
104
105 /**
106 * Get the information required to solicit an UL MU transmission on the given link. Note
107 * that this method can only be called if GetTxFormat returns UL_MU_TX on the given link.
108 *
109 * \param linkId the ID of the given link
110 * \return the information required to solicit an UL MU transmission
111 */
112 UlMuInfo& GetUlMuInfo(uint8_t linkId);
113
114 /**
115 * Set the duration of the interval between two consecutive requests for channel
116 * access made by the MultiUserScheduler.
117 *
118 * \param interval the duration of the interval between two consecutive requests
119 * for channel access
120 */
121 void SetAccessReqInterval(Time interval);
122
123 /**
124 * \return the duration of the interval between two consecutive requests for channel access
125 */
127
128 protected:
129 /**
130 * Get the station manager attached to the AP on the given link.
131 *
132 * \param linkId the ID of the given link
133 * \return the station manager attached to the AP on the given link
134 */
136
137 /**
138 * Get the HE Frame Exchange Manager attached to the AP on the given link.
139 *
140 * \param linkId the ID of the given link
141 * \return the HE Frame Exchange Manager attached to the AP on the given link
142 */
143 Ptr<HeFrameExchangeManager> GetHeFem(uint8_t linkId) const;
144
145 /**
146 * Get an MPDU containing the given Trigger Frame.
147 *
148 * \param trigger the given Trigger Frame
149 * \param linkId the ID of the link on which the Trigger Frame has to be sent
150 * \return an MPDU containing the given Trigger Frame
151 */
152 Ptr<WifiMpdu> GetTriggerFrame(const CtrlTriggerHeader& trigger, uint8_t linkId) const;
153
154 /**
155 * Get the format of the last transmission on the given link, as determined by
156 * the last call to NotifyAccessGranted that did not return NO_TX.
157 *
158 * \param linkId the ID of the given link
159 * \return the format of the last transmission on the given link
160 */
161 TxFormat GetLastTxFormat(uint8_t linkId);
162
163 /**
164 * Get the maximum size in bytes among the A-MPDUs containing QoS Null frames
165 * and solicited by the given (BSRP) Trigger Frame. For each station addressed
166 * by the Trigger Frame, the expected response is an A-MPDU containing as many
167 * QoS Null frames as the number of TIDs for which a BlockAck agreement has
168 * been established between the station and the AP.
169 *
170 * \param trigger the given Trigger Frame
171 * \return the maximum size in bytes among the A-MPDUs containing QoS Null frames
172 * and solicited by the given Trigger Frame
173 */
175
176 void DoDispose() override;
177 void NotifyNewAggregate() override;
178 void DoInitialize() override;
179
180 Ptr<ApWifiMac> m_apMac; //!< the AP wifi MAC
181 Ptr<QosTxop> m_edca; //!< the AC that gained channel access
182 Time m_availableTime; //!< the time available for frame exchange
183 bool m_initialFrame; //!< true if a TXOP is being started
184 MHz_u m_allowedWidth; //!< the allowed width for the current transmission
185 uint8_t m_linkId; //!< the ID of the link over which channel access has been granted
186
187 private:
188 /**
189 * Set the wifi MAC. Note that it must be the MAC of an HE AP.
190 *
191 * \param mac the AP wifi MAC
192 */
193 void SetWifiMac(Ptr<ApWifiMac> mac);
194
195 /**
196 * Perform actions required on expiration of the channel access request timer associated with
197 * the given link, such as requesting channel access (if not requested already) and restarting
198 * the channel access request timer.
199 *
200 * \param linkId the ID of the given link
201 */
202 void AccessReqTimeout(uint8_t linkId);
203
204 /**
205 * Select the format of the next transmission.
206 *
207 * \return the format of the next transmission
208 */
210
211 /**
212 * Compute the information required to perform a DL MU transmission.
213 *
214 * \return the information required to perform a DL MU transmission
215 */
217
218 /**
219 * Prepare the information required to solicit an UL MU transmission.
220 *
221 * \return the information required to solicit an UL MU transmission
222 */
224
225 /**
226 * Ensure that the Trigger Frame returned in case of UL MU transmission is
227 * correct. Currently, this method sets the CS Required, the AP Tx Power and
228 * the UL Target Receive Power subfields.
229 */
230 void CheckTriggerFrame();
231
232 /**
233 * Type for the information about the last transmission
234 */
236 {
237 TxFormat lastTxFormat{NO_TX}; ///< the format of last transmission
238 DlMuInfo dlInfo; ///< information required to perform a DL MU transmission
239 UlMuInfo ulInfo; ///< information required to solicit an UL MU transmission
240 };
241
242 std::map<uint8_t, LastTxInfo> m_lastTxInfo; ///< Information about the last transmission
243 std::vector<EventId>
244 m_accessReqTimers; ///< the per-link timer controlling additional channel access requests
245 Time m_accessReqInterval; ///< duration of the interval between channel access requests
246 AcIndex m_accessReqAc; ///< AC we request channel access for
247 bool m_restartTimerUponAccess; ///< whether the channel access timer has to be restarted
248 ///< upon channel access
249};
250
251} // namespace ns3
252
253#endif /* MULTI_USER_SCHEDULER_H */
Headers for Trigger frames.
MultiUserScheduler is an abstract base class defining the API that APs supporting at least VHT can us...
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.
void DoInitialize() override
Initialize() implementation.
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
std::vector< EventId > m_accessReqTimers
the per-link timer controlling additional channel access requests
void CheckTriggerFrame()
Ensure that the Trigger Frame returned in case of UL MU transmission is correct.
static TypeId GetTypeId()
Get the type ID.
Time m_availableTime
the time available for frame exchange
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...
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.
MHz_u m_allowedWidth
the allowed width for the current transmission
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
TxFormat NotifyAccessGranted(Ptr< QosTxop > edca, Time availableTime, bool initialFrame, MHz_u allowedWidth, uint8_t linkId)
Notify the Multi-user Scheduler that the given AC of the AP gained channel access.
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.
void AccessReqTimeout(uint8_t linkId)
Perform actions required on expiration of the channel access request timer associated with the given ...
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Implements the IEEE 802.11 MAC header.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:62
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
Information to be provided in case of DL MU transmission.
WifiTxParameters txParams
the transmission parameters
WifiPsduMap psduMap
the DL MU PPDU to transmit
Type for the information about the last transmission.
TxFormat lastTxFormat
the format of last transmission
UlMuInfo ulInfo
information required to solicit an UL MU transmission
DlMuInfo dlInfo
information required to perform a DL MU transmission
Information to be provided in case of UL MU transmission.
WifiTxParameters txParams
the transmission parameters for the Trigger Frame
CtrlTriggerHeader trigger
the Trigger Frame used to solicit TB PPDUs
WifiMacHeader macHdr
the MAC header for the Trigger Frame