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