A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
rr-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 RR_MULTI_USER_SCHEDULER_H
10#define RR_MULTI_USER_SCHEDULER_H
11
13
14#include <functional>
15#include <list>
16
17namespace ns3
18{
19
20/**
21 * \ingroup wifi
22 *
23 * RrMultiUserScheduler is a simple OFDMA scheduler that indicates to perform a DL OFDMA
24 * transmission if the AP has frames to transmit to at least one station.
25 * RrMultiUserScheduler assigns RUs of equal size (in terms of tones) to stations to
26 * which the AP has frames to transmit belonging to the AC who gained access to the
27 * channel or higher. The maximum number of stations that can be granted an RU is
28 * configurable. Associated stations are served based on their priority. The priority is
29 * determined by the credits/debits a station gets when it is selected or not for transmission.
30 *
31 * \todo Take the supported channel width of the stations into account while selecting
32 * stations and assigning RUs to them.
33 */
35{
36 public:
37 /**
38 * \brief Get the type ID.
39 * \return the object TypeId
40 */
41 static TypeId GetTypeId();
43 ~RrMultiUserScheduler() override;
44
45 protected:
46 void DoDispose() override;
47 void DoInitialize() override;
48
49 /**
50 * Information used to sort stations
51 */
53 {
54 uint16_t aid; //!< station's AID
55 Mac48Address address; //!< station's MAC Address
56 double credits; //!< credits accumulated by the station
57 };
58
59 /**
60 * Determine whether the given STA can be solicited via a Basic Trigger Frame.
61 *
62 * \param info the information about the given STA
63 * \return whether the given STA can be solicited via a Basic Trigger Frame
64 */
65 virtual bool CanSolicitStaInBasicTf(const MasterInfo& info) const;
66
67 /**
68 * Determine whether the given STA can be solicited via a BSRP Trigger Frame.
69 *
70 * \param info the information about the given STA
71 * \return whether the given STA can be solicited via a BSRP Trigger Frame
72 */
73 virtual bool CanSolicitStaInBsrpTf(const MasterInfo& info) const;
74
75 private:
76 TxFormat SelectTxFormat() override;
77 DlMuInfo ComputeDlMuInfo() override;
78 UlMuInfo ComputeUlMuInfo() override;
79
80 /**
81 * Check if it is possible to send a BSRP Trigger Frame given the current
82 * time limits.
83 *
84 * \return UL_MU_TX if it is possible to send a BSRP TF, NO_TX otherwise
85 */
86 virtual TxFormat TrySendingBsrpTf();
87
88 /**
89 * Check if it is possible to send a Basic Trigger Frame given the current
90 * time limits.
91 *
92 * \return UL_MU_TX if it is possible to send a Basic TF, DL_MU_TX if we can try
93 * to send a DL MU PPDU and NO_TX if the remaining time is too short
94 */
96
97 /**
98 * Check if it is possible to send a DL MU PPDU given the current
99 * time limits.
100 *
101 * \return DL_MU_TX if it is possible to send a DL MU PPDU, SU_TX if a SU PPDU
102 * can be transmitted (e.g., there are no HE stations associated or sending
103 * a DL MU PPDU is not possible and m_forceDlOfdma is false) or NO_TX otherwise
104 */
106
107 /**
108 * Compute a TXVECTOR that can be used to construct a Trigger Frame to solicit
109 * transmissions from suitable stations, i.e., stations that have established a
110 * BlockAck agreement with the AP and for which the given predicate returns true.
111 *
112 * \param canBeSolicited a predicate returning false for stations that shall not be solicited
113 * \return a TXVECTOR that can be used to construct a Trigger Frame to solicit
114 * transmissions from suitable stations
115 */
116 virtual WifiTxVector GetTxVectorForUlMu(std::function<bool(const MasterInfo&)> canBeSolicited);
117
118 /**
119 * Notify the scheduler that a station associated with the AP
120 *
121 * \param aid the AID of the station
122 * \param address the MAC address of the station
123 */
124 void NotifyStationAssociated(uint16_t aid, Mac48Address address);
125 /**
126 * Notify the scheduler that a station deassociated with the AP
127 *
128 * \param aid the AID of the station
129 * \param address the MAC address of the station
130 */
131 void NotifyStationDeassociated(uint16_t aid, Mac48Address address);
132
133 /**
134 * Finalize the given TXVECTOR by only including the largest subset of the
135 * current set of candidate stations that can be allocated equal-sized RUs
136 * (with the possible exception of using central 26-tone RUs) without
137 * leaving RUs unallocated. The given TXVECTOR must be a MU TXVECTOR and must
138 * contain an HeMuUserInfo entry for each candidate station. The finalized
139 * TXVECTOR contains a subset of such HeMuUserInfo entries. The set of candidate
140 * stations is also updated by removing stations that are not allocated an RU.
141 *
142 * \param txVector the given TXVECTOR
143 */
144 void FinalizeTxVector(WifiTxVector& txVector);
145 /**
146 * Update credits of the stations in the given list considering that a PPDU having
147 * the given duration is being transmitted or solicited by using the given TXVECTOR.
148 *
149 * \param staList the list of stations
150 * \param txDuration the TX duration of the PPDU being transmitted or solicited
151 * \param txVector the TXVECTOR for the PPDU being transmitted or solicited
152 */
153 void UpdateCredits(std::list<MasterInfo>& staList,
154 Time txDuration,
155 const WifiTxVector& txVector);
156
157 /**
158 * Information stored for candidate stations
159 */
160 typedef std::pair<std::list<MasterInfo>::iterator, Ptr<WifiMpdu>> CandidateInfo;
161
162 uint8_t m_nStations; //!< Number of stations/slots to fill
163 bool m_enableTxopSharing; //!< allow A-MPDUs of different TIDs in a DL MU PPDU
164 bool m_forceDlOfdma; //!< return DL_OFDMA even if no DL MU PPDU was built
165 bool m_enableUlOfdma; //!< enable the scheduler to also return UL_OFDMA
166 bool m_enableBsrp; //!< send a BSRP before an UL MU transmission
167 bool m_useCentral26TonesRus; //!< whether to allocate central 26-tone RUs
168 uint32_t m_ulPsduSize; //!< the size in byte of the solicited PSDU
169 std::map<AcIndex, std::list<MasterInfo>>
170 m_staListDl; //!< Per-AC list of stations (next to serve for DL first)
171 std::list<MasterInfo> m_staListUl; //!< List of stations to serve for UL
172 std::list<CandidateInfo> m_candidates; //!< Candidate stations for MU TX
173 Time m_maxCredits; //!< Max amount of credits a station can have
174 CtrlTriggerHeader m_trigger; //!< Trigger Frame to send
175 WifiMacHeader m_triggerMacHdr; //!< MAC header for Trigger Frame
176 WifiTxParameters m_txParams; //!< TX parameters
177};
178
179} // namespace ns3
180
181#endif /* RR_MULTI_USER_SCHEDULER_H */
Headers for Trigger frames.
an EUI-48 address
MultiUserScheduler is an abstract base class defining the API that APs supporting at least VHT can us...
TxFormat
Enumeration of the possible transmission formats.
Smart pointer class similar to boost::intrusive_ptr.
RrMultiUserScheduler is a simple OFDMA scheduler that indicates to perform a DL OFDMA transmission if...
TxFormat SelectTxFormat() override
Select the format of the next transmission.
bool m_enableBsrp
send a BSRP before an UL MU transmission
void NotifyStationAssociated(uint16_t aid, Mac48Address address)
Notify the scheduler that a station associated with the AP.
static TypeId GetTypeId()
Get the type ID.
uint32_t m_ulPsduSize
the size in byte of the solicited PSDU
std::list< CandidateInfo > m_candidates
Candidate stations for MU TX.
bool m_useCentral26TonesRus
whether to allocate central 26-tone RUs
bool m_forceDlOfdma
return DL_OFDMA even if no DL MU PPDU was built
bool m_enableUlOfdma
enable the scheduler to also return UL_OFDMA
std::pair< std::list< MasterInfo >::iterator, Ptr< WifiMpdu > > CandidateInfo
Information stored for candidate stations.
void DoInitialize() override
Initialize() implementation.
UlMuInfo ComputeUlMuInfo() override
Prepare the information required to solicit an UL MU transmission.
DlMuInfo ComputeDlMuInfo() override
Compute the information required to perform a DL MU transmission.
void DoDispose() override
Destructor implementation.
void UpdateCredits(std::list< MasterInfo > &staList, Time txDuration, const WifiTxVector &txVector)
Update credits of the stations in the given list considering that a PPDU having the given duration is...
WifiMacHeader m_triggerMacHdr
MAC header for Trigger Frame.
uint8_t m_nStations
Number of stations/slots to fill.
WifiTxParameters m_txParams
TX parameters.
virtual TxFormat TrySendingDlMuPpdu()
Check if it is possible to send a DL MU PPDU given the current time limits.
void NotifyStationDeassociated(uint16_t aid, Mac48Address address)
Notify the scheduler that a station deassociated with the AP.
Time m_maxCredits
Max amount of credits a station can have.
virtual WifiTxVector GetTxVectorForUlMu(std::function< bool(const MasterInfo &)> canBeSolicited)
Compute a TXVECTOR that can be used to construct a Trigger Frame to solicit transmissions from suitab...
bool m_enableTxopSharing
allow A-MPDUs of different TIDs in a DL MU PPDU
CtrlTriggerHeader m_trigger
Trigger Frame to send.
std::map< AcIndex, std::list< MasterInfo > > m_staListDl
Per-AC list of stations (next to serve for DL first)
virtual bool CanSolicitStaInBasicTf(const MasterInfo &info) const
Determine whether the given STA can be solicited via a Basic Trigger Frame.
virtual TxFormat TrySendingBsrpTf()
Check if it is possible to send a BSRP Trigger Frame given the current time limits.
virtual bool CanSolicitStaInBsrpTf(const MasterInfo &info) const
Determine whether the given STA can be solicited via a BSRP Trigger Frame.
virtual TxFormat TrySendingBasicTf()
Check if it is possible to send a Basic Trigger Frame given the current time limits.
void FinalizeTxVector(WifiTxVector &txVector)
Finalize the given TXVECTOR by only including the largest subset of the current set of candidate stat...
std::list< MasterInfo > m_staListUl
List of stations to serve for UL.
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,...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Information to be provided in case of DL MU transmission.
Information to be provided in case of UL MU transmission.
Information used to sort stations.
Mac48Address address
station's MAC Address
double credits
credits accumulated by the station