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 Time GetExtraTimeForBsrpTfDurationId(uint8_t linkId) const override;
46
47 /**
48 * Information used to sort stations
49 */
51 {
52 uint16_t aid{0}; //!< station's AID
53 Mac48Address address; //!< station's MAC Address
54 double credits{0.}; //!< credits accumulated by the station
55 };
56
57 /**
58 * @brief Get UL MU eligible stations list
59 *
60 * @return list of UL MU eligible stations
61 */
62 virtual const std::list<MasterInfo>& GetUlMuStas() const;
63
64 protected:
65 void DoDispose() override;
66 void DoInitialize() override;
67
68 void UpdateTriggerFrameAfterProtection(uint8_t linkId,
69 CtrlTriggerHeader& trigger,
70 WifiTxParameters& txParams) const override;
71 void UpdateDlMuAfterProtection(uint8_t linkId,
72 WifiPsduMap& psduMap,
73 WifiTxParameters& txParams) const override;
74
75 /**
76 * Determine whether the given STA can be solicited via a Basic Trigger Frame.
77 *
78 * @param info the information about the given STA
79 * @return whether the given STA can be solicited via a Basic Trigger Frame
80 */
81 virtual bool CanSolicitStaInBasicTf(const MasterInfo& info) const;
82
83 /**
84 * Determine whether the given STA can be solicited via a BSRP Trigger Frame.
85 *
86 * @param info the information about the given STA
87 * @return whether the given STA can be solicited via a BSRP Trigger Frame
88 */
89 virtual bool CanSolicitStaInBsrpTf(const MasterInfo& info) const;
90
91 private:
92 TxFormat SelectTxFormat() override;
93 DlMuInfo ComputeDlMuInfo() override;
94 UlMuInfo ComputeUlMuInfo() override;
95
96 /**
97 * Check if it is possible to send a BSRP Trigger Frame given the current
98 * time limits.
99 *
100 * @return UL_MU_TX if it is possible to send a BSRP TF, NO_TX otherwise
101 */
102 virtual TxFormat TrySendingBsrpTf();
103
104 /**
105 * Check if it is possible to send a Basic Trigger Frame given the current
106 * time limits.
107 *
108 * @return UL_MU_TX if it is possible to send a Basic TF, DL_MU_TX if we can try
109 * to send a DL MU PPDU and NO_TX if the remaining time is too short
110 */
111 virtual TxFormat TrySendingBasicTf();
112
113 /**
114 * Check if it is possible to send a DL MU PPDU given the current
115 * time limits.
116 *
117 * @return DL_MU_TX if it is possible to send a DL MU PPDU, SU_TX if a SU PPDU
118 * can be transmitted (e.g., there are no HE stations associated or sending
119 * a DL MU PPDU is not possible and m_forceDlOfdma is false) or NO_TX otherwise
120 */
121 virtual TxFormat TrySendingDlMuPpdu();
122
123 /**
124 * Compute a TXVECTOR that can be used to construct a Trigger Frame to solicit
125 * transmissions from suitable stations, i.e., stations that have established a
126 * BlockAck agreement with the AP and for which the given predicate returns true.
127 *
128 * @param canBeSolicited a predicate returning false for stations that shall not be solicited
129 * @return a TXVECTOR that can be used to construct a Trigger Frame to solicit
130 * transmissions from suitable stations
131 */
132 virtual WifiTxVector GetTxVectorForUlMu(std::function<bool(const MasterInfo&)> canBeSolicited);
133
134 /**
135 * Notify the scheduler that a station associated with the AP
136 *
137 * @param aid the AID of the station
138 * @param address the MAC address of the station
139 */
140 void NotifyStationAssociated(uint16_t aid, Mac48Address address);
141 /**
142 * Notify the scheduler that a station deassociated with the AP
143 *
144 * @param aid the AID of the station
145 * @param address the MAC address of the station
146 */
147 void NotifyStationDeassociated(uint16_t aid, Mac48Address address);
148
149 /**
150 * Finalize the given TXVECTOR by only including the largest subset of the
151 * current set of candidate stations that can be allocated equal-sized RUs
152 * (with the possible exception of using central 26-tone RUs) without
153 * leaving RUs unallocated. The given TXVECTOR must be a MU TXVECTOR and must
154 * contain an HeMuUserInfo entry for each candidate station. The finalized
155 * TXVECTOR contains a subset of such HeMuUserInfo entries. The set of candidate
156 * stations is also updated by removing stations that are not allocated an RU.
157 *
158 * @param txVector the given TXVECTOR
159 */
160 void FinalizeTxVector(WifiTxVector& txVector);
161 /**
162 * Update credits of the stations in the given list considering that a PPDU having
163 * the given duration is being transmitted or solicited by using the given TXVECTOR.
164 *
165 * @param staList the list of stations
166 * @param txDuration the TX duration of the PPDU being transmitted or solicited
167 * @param txVector the TXVECTOR for the PPDU being transmitted or solicited
168 */
169 void UpdateCredits(std::list<MasterInfo>& staList,
170 Time txDuration,
171 const WifiTxVector& txVector);
172
173 /**
174 * Information stored for candidate stations
175 */
176 typedef std::pair<std::list<MasterInfo>::iterator, Ptr<WifiMpdu>> CandidateInfo;
177
178 uint8_t m_nStations; //!< Number of stations/slots to fill
179 bool m_enableTxopSharing; //!< allow A-MPDUs of different TIDs in a DL MU PPDU
180 bool m_forceDlOfdma; //!< return DL_OFDMA even if no DL MU PPDU was built
181 bool m_enableUlOfdma; //!< enable the scheduler to also return UL_OFDMA
182 bool m_enableBsrp; //!< send a BSRP before an UL MU transmission
183 bool m_useCentral26TonesRus; //!< whether to allocate central 26-tone RUs
184 uint32_t m_ulPsduSize; //!< the size in byte of the solicited PSDU
185 std::map<AcIndex, std::list<MasterInfo>>
186 m_staListDl; //!< Per-AC list of stations (next to serve for DL first)
187 std::list<MasterInfo> m_staListUl; //!< List of stations to serve for UL
188 std::list<CandidateInfo> m_candidates; //!< Candidate stations for MU TX
189 Time m_maxCredits; //!< Max amount of credits a station can have
190 CtrlTriggerHeader m_trigger; //!< Trigger Frame to send
191 WifiMacHeader m_triggerMacHdr; //!< MAC header for Trigger Frame
192 Time m_triggerTxDuration{0}; //!< Trigger Frame TX duration
193 WifiTxParameters m_txParams; //!< TX parameters
194};
195
196} // namespace ns3
197
198#endif /* RR_MULTI_USER_SCHEDULER_H */
Headers for Trigger frames.
an EUI-48 address
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:67
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.
virtual const std::list< MasterInfo > & GetUlMuStas() const
Get UL MU eligible stations list.
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.
Time m_triggerTxDuration
Trigger Frame TX duration.
void UpdateDlMuAfterProtection(uint8_t linkId, WifiPsduMap &psduMap, WifiTxParameters &txParams) const override
Update the given PSDU map after protection is completed on the given link.
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.
void UpdateTriggerFrameAfterProtection(uint8_t linkId, CtrlTriggerHeader &trigger, WifiTxParameters &txParams) const override
Update the given Trigger Frame after protection is completed on the given link.
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...
Time GetExtraTimeForBsrpTfDurationId(uint8_t linkId) const override
When the TXOP limit is zero and the TXOP continues a SIFS after receiving a response to a BSRP TF,...
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:96
a unique identifier for an interface.
Definition type-id.h:49
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.
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
Definition wifi-mac.h:78
Information used to sort stations.
Mac48Address address
station's MAC Address
double credits
credits accumulated by the station