A Discrete-Event Network Simulator
API
he-ppdu.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Orange Labs
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: Rediet <getachew.redieteab@orange.com>
18  * Muhammad Iqbal Rochman <muhiqbalcr@uchicago.edu>
19  * Sébastien Deronne <sebastien.deronne@gmail.com> (HeSigHeader)
20  */
21 
22 #ifndef HE_PPDU_H
23 #define HE_PPDU_H
24 
25 #include "ns3/ofdm-ppdu.h"
26 
33 namespace ns3
34 {
35 
36 class WifiPsdu;
37 
44 class HePpdu : public OfdmPpdu
45 {
46  public:
50  class HeSigHeader : public Header
51  {
52  public:
53  HeSigHeader();
54 
59  static TypeId GetTypeId();
60 
61  TypeId GetInstanceTypeId() const override;
62  void Print(std::ostream& os) const override;
63  uint32_t GetSerializedSize() const override;
64  void Serialize(Buffer::Iterator start) const override;
65  uint32_t Deserialize(Buffer::Iterator start) override;
66 
72  void SetMuFlag(bool mu);
73 
79  void SetMcs(uint8_t mcs);
85  uint8_t GetMcs() const;
91  void SetBssColor(uint8_t bssColor);
97  uint8_t GetBssColor() const;
103  void SetChannelWidth(uint16_t channelWidth);
109  uint16_t GetChannelWidth() const;
116  void SetGuardIntervalAndLtfSize(uint16_t gi, uint8_t ltf);
122  uint16_t GetGuardInterval() const;
128  void SetNStreams(uint8_t nStreams);
134  uint8_t GetNStreams() const;
135 
136  private:
137  // HE-SIG-A1 fields
138  uint8_t m_format;
139  uint8_t m_bssColor;
140  uint8_t m_ul_dl;
141  uint8_t m_mcs;
142  uint8_t m_spatialReuse;
143  uint8_t m_bandwidth;
144  uint8_t m_gi_ltf_size;
145  uint8_t m_nsts;
146 
148  bool m_mu;
149  }; // class HeSigHeader
150 
156  {
159  };
160 
172  const WifiTxVector& txVector,
173  uint16_t txCenterFreq,
174  Time ppduDuration,
175  WifiPhyBand band,
176  uint64_t uid);
190  HePpdu(const WifiConstPsduMap& psdus,
191  const WifiTxVector& txVector,
192  uint16_t txCenterFreq,
193  Time ppduDuration,
194  WifiPhyBand band,
195  uint64_t uid,
196  TxPsdFlag flag);
197 
198  Time GetTxDuration() const override;
199  Ptr<WifiPpdu> Copy() const override;
200  WifiPpduType GetType() const override;
201  uint16_t GetStaId() const override;
202  uint16_t GetTransmissionChannelWidth() const override;
203 
211  Ptr<const WifiPsdu> GetPsdu(uint8_t bssColor, uint16_t staId = SU_STA_ID) const;
212 
218  TxPsdFlag GetTxPsdFlag() const;
219 
225  void SetTxPsdFlag(TxPsdFlag flag) const;
226 
234  void UpdateTxVectorForUlMu(const std::optional<WifiTxVector>& trigVector) const;
235 
242  bool IsStaInContentChannel(uint16_t staId, size_t channelId) const;
243 
249  bool IsAllocated(uint16_t staId) const;
250 
251  protected:
259  virtual void SetTxVectorFromPhyHeaders(WifiTxVector& txVector,
260  const LSigHeader& lSig,
261  const HeSigHeader& heSig) const;
262 
263 #ifndef NS3_BUILD_PROFILE_DEBUG
264  HeSigHeader m_heSig;
265 #endif
267 
275 
276  private:
277  std::string PrintPayload() const override;
278  WifiTxVector DoGetTxVector() const override;
279 
284  virtual bool IsMu() const;
285 
290  virtual bool IsDlMu() const;
291 
296  virtual bool IsUlMu() const;
297 
304  virtual void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
305 
312  virtual void SetLSigHeader(LSigHeader& lSig, Time ppduDuration) const;
313 
320  void SetHeSigHeader(HeSigHeader& heSig, const WifiTxVector& txVector) const;
321 }; // class HePpdu
322 
330 std::ostream& operator<<(std::ostream& os, const HePpdu::TxPsdFlag& flag);
331 
332 } // namespace ns3
333 
334 #endif /* HE_PPDU_H */
iterator in a Buffer instance
Definition: buffer.h:100
HE-SIG PHY header (HE-SIG-A1/A2/B)
Definition: he-ppdu.h:51
uint8_t m_bssColor
BSS color field.
Definition: he-ppdu.h:139
static TypeId GetTypeId()
Get the type ID.
Definition: he-ppdu.cc:461
void SetChannelWidth(uint16_t channelWidth)
Fill the channel width field of HE-SIG-A1 (in MHz).
Definition: he-ppdu.cc:529
uint16_t GetGuardInterval() const
Return the guard interval (in nanoseconds).
Definition: he-ppdu.cc:592
uint8_t m_bandwidth
Bandwidth field.
Definition: he-ppdu.h:143
uint8_t m_mcs
MCS field.
Definition: he-ppdu.h:141
uint8_t m_format
Format bit.
Definition: he-ppdu.h:138
void SetBssColor(uint8_t bssColor)
Fill the BSS Color field of HE-SIG-A1.
Definition: he-ppdu.cc:516
uint8_t GetBssColor() const
Return the BSS Color field in the HE-SIG-A1.
Definition: he-ppdu.cc:523
uint8_t GetMcs() const
Return the MCS field of HE-SIG-A1.
Definition: he-ppdu.cc:510
uint8_t m_nsts
NSTS.
Definition: he-ppdu.h:145
uint32_t GetSerializedSize() const override
Definition: he-ppdu.cc:484
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: he-ppdu.cc:471
void SetMuFlag(bool mu)
Set the Multi-User (MU) flag.
Definition: he-ppdu.cc:497
uint16_t GetChannelWidth() const
Return the channel width (in MHz).
Definition: he-ppdu.cc:550
void Print(std::ostream &os) const override
Definition: he-ppdu.cc:477
void Serialize(Buffer::Iterator start) const override
Definition: he-ppdu.cc:623
uint8_t m_gi_ltf_size
GI+LTF Size field.
Definition: he-ppdu.h:144
void SetGuardIntervalAndLtfSize(uint16_t gi, uint8_t ltf)
Fill the GI + LTF size field of HE-SIG-A1.
Definition: he-ppdu.cc:571
void SetMcs(uint8_t mcs)
Fill the MCS field of HE-SIG-A1.
Definition: he-ppdu.cc:503
uint8_t GetNStreams() const
Return the number of streams.
Definition: he-ppdu.cc:617
bool m_mu
This is used to decide whether MU SIG-B should be added or not.
Definition: he-ppdu.h:148
uint8_t m_spatialReuse
Spatial Reuse field.
Definition: he-ppdu.h:142
uint8_t m_ul_dl
UL/DL bit.
Definition: he-ppdu.h:140
void SetNStreams(uint8_t nStreams)
Fill the number of streams field of HE-SIG-A1.
Definition: he-ppdu.cc:610
HE PPDU (11ax)
Definition: he-ppdu.h:45
void SetTxPsdFlag(TxPsdFlag flag) const
Definition: he-ppdu.cc:374
WifiTxVector DoGetTxVector() const override
Get the TXVECTOR used to send the PPDU.
Definition: he-ppdu.cc:165
void UpdateTxVectorForUlMu(const std::optional< WifiTxVector > &trigVector) const
Update the TXVECTOR for HE TB PPDUs, since the information to decode HE TB PPDUs is not available fro...
Definition: he-ppdu.cc:381
Ptr< WifiPpdu > Copy() const override
Copy this instance.
Definition: he-ppdu.cc:261
virtual void SetTxVectorFromPhyHeaders(WifiTxVector &txVector, const LSigHeader &lSig, const HeSigHeader &heSig) const
Fill in the TXVECTOR from PHY headers.
Definition: he-ppdu.cc:194
TxPsdFlag
The transmit power spectral density flag, namely used to correctly build PSDs for pre-HE and HE porti...
Definition: he-ppdu.h:156
@ PSD_HE_PORTION
HE portion of an HE PPDU.
Definition: he-ppdu.h:158
@ PSD_NON_HE_PORTION
Non-HE portion of an HE PPDU.
Definition: he-ppdu.h:157
virtual bool IsDlMu() const
Return true if the PPDU is a DL MU PPDU.
Definition: he-ppdu.cc:287
Time GetTxDuration() const override
Get the total transmission duration of the PPDU.
Definition: he-ppdu.cc:226
virtual bool IsUlMu() const
Return true if the PPDU is an UL MU PPDU.
Definition: he-ppdu.cc:293
ContentChannelAllocation m_contentChannelAlloc
HE SIG-B Content Channel allocation (to be removed once HE-SIG-B headers are implemented)
Definition: he-ppdu.h:271
WifiTxVector::HeMuUserInfoMap m_muUserInfos
HE MU specific per-user information (to be removed once HE-SIG-B headers are implemented)
Definition: he-ppdu.h:268
virtual void SetPhyHeaders(const WifiTxVector &txVector, Time ppduDuration)
Fill in the PHY headers.
Definition: he-ppdu.cc:106
bool IsAllocated(uint16_t staId) const
Check if STA ID is allocated.
Definition: he-ppdu.cc:417
std::string PrintPayload() const override
Print the payload of the PPDU.
Definition: he-ppdu.cc:432
uint16_t GetStaId() const override
Get the ID of the STA that transmitted the PPDU for UL MU, SU_STA_ID otherwise.
Definition: he-ppdu.cc:342
WifiPpduType GetType() const override
Return the PPDU type (.
Definition: he-ppdu.cc:267
TxPsdFlag GetTxPsdFlag() const
Definition: he-ppdu.cc:368
HePpdu(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, uint16_t txCenterFreq, Time ppduDuration, WifiPhyBand band, uint64_t uid)
Create an SU HE PPDU, storing a PSDU.
Definition: he-ppdu.cc:86
virtual bool IsMu() const
Return true if the PPDU is a MU PPDU.
Definition: he-ppdu.cc:281
RuAllocation m_ruAllocation
RU_ALLOCATION in SIG-B common field (to be removed once HE-SIG-B headers are implemented)
Definition: he-ppdu.h:273
virtual void SetLSigHeader(LSigHeader &lSig, Time ppduDuration) const
Fill in the L-SIG header.
Definition: he-ppdu.cc:126
bool IsStaInContentChannel(uint16_t staId, size_t channelId) const
Check if STA ID is in HE SIG-B Content Channel ID.
Definition: he-ppdu.cc:423
TxPsdFlag m_txPsdFlag
the transmit power spectral density flag
Definition: he-ppdu.h:266
void SetHeSigHeader(HeSigHeader &heSig, const WifiTxVector &txVector) const
Fill in the HE-SIG header.
Definition: he-ppdu.cc:144
uint16_t GetTransmissionChannelWidth() const override
Get the channel width over which the PPDU will effectively be transmitted.
Definition: he-ppdu.cc:349
Protocol header serialization and deserialization.
Definition: header.h:44
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
OFDM and ERP OFDM L-SIG PHY header.
Definition: ofdm-ppdu.h:55
OFDM PPDU (11a)
Definition: ofdm-ppdu.h:48
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:60
Ptr< const WifiPsdu > GetPsdu() const
Get the payload of the PPDU.
Definition: wifi-ppdu.cc:117
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
std::map< uint16_t, HeMuUserInfo > HeMuUserInfoMap
map of HE MU specific user info parameters indexed by STA-ID
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::vector< std::vector< uint16_t > > ContentChannelAllocation
HE SIG-B Content Channels STA ID Allocation.
std::vector< uint8_t > RuAllocation
8 bit RU_ALLOCATION per 20 MHz
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
#define SU_STA_ID
Definition: wifi-mode.h:34