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