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