A Discrete-Event Network Simulator
API
wifi-tx-vector.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 CTTC
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  * Authors: Nicola Baldo <nbaldo@cttc.es>
18  * Ghada Badawy <gbadawy@gmail.com>
19  */
20 
21 #ifndef WIFI_TX_VECTOR_H
22 #define WIFI_TX_VECTOR_H
23 
24 #include "wifi-mode.h"
25 #include "wifi-phy-band.h"
26 #include "wifi-phy-common.h"
27 
28 #include "ns3/he-ru.h"
29 
30 #include <list>
31 #include <optional>
32 #include <set>
33 #include <vector>
34 
35 namespace ns3
36 {
37 
39 static constexpr uint16_t NO_USER_STA_ID = 2046;
40 
43 {
45  uint8_t mcs;
46  uint8_t nss;
47 
54  bool operator==(const HeMuUserInfo& other) const;
61  bool operator!=(const HeMuUserInfo& other) const;
62 };
63 
65 using RuAllocation = std::vector<uint8_t>;
66 
72 {
74  CENTER_26_TONE_RU_LOW_80_MHZ_ALLOCATED, /* also used if BW == 80 MHz */
75  CENTER_26_TONE_RU_HIGH_80_MHZ_ALLOCATED, /* unused if BW < 160 MHz */
77  CENTER_26_TONE_RU_INDICATION_MAX /* last value */
78 };
79 
111 {
112  public:
114  typedef std::map<uint16_t /* staId */, HeMuUserInfo /* HE MU specific user info */>
116 
117  WifiTxVector();
136  WifiTxVector(WifiMode mode,
137  uint8_t powerLevel,
138  WifiPreamble preamble,
139  uint16_t guardInterval,
140  uint8_t nTx,
141  uint8_t nss,
142  uint8_t ness,
143  uint16_t channelWidth,
144  bool aggregation,
145  bool stbc = false,
146  bool ldpc = false,
147  uint8_t bssColor = 0,
148  uint16_t length = 0,
149  bool triggerResponding = false);
154  WifiTxVector(const WifiTxVector& txVector);
155 
159  bool GetModeInitialized() const;
169  WifiMode GetMode(uint16_t staId = SU_STA_ID) const;
175  void SetMode(WifiMode mode);
182  void SetMode(WifiMode mode, uint16_t staId);
183 
190 
194  uint8_t GetTxPowerLevel() const;
200  void SetTxPowerLevel(uint8_t powerlevel);
210  void SetPreambleType(WifiPreamble preamble);
214  uint16_t GetChannelWidth() const;
220  void SetChannelWidth(uint16_t channelWidth);
224  uint16_t GetGuardInterval() const;
230  void SetGuardInterval(uint16_t guardInterval);
234  uint8_t GetNTx() const;
240  void SetNTx(uint8_t nTx);
250  uint8_t GetNss(uint16_t staId = SU_STA_ID) const;
254  uint8_t GetNssMax() const;
258  uint8_t GetNssTotal() const;
264  void SetNss(uint8_t nss);
271  void SetNss(uint8_t nss, uint16_t staId);
275  uint8_t GetNess() const;
281  void SetNess(uint8_t ness);
287  bool IsAggregation() const;
293  void SetAggregation(bool aggregation);
300  bool IsStbc() const;
306  void SetStbc(bool stbc);
313  bool IsLdpc() const;
319  void SetLdpc(bool ldpc);
325  bool IsNonHtDuplicate() const;
330  void SetBssColor(uint8_t color);
335  uint8_t GetBssColor() const;
340  void SetLength(uint16_t length);
345  uint16_t GetLength() const;
350  bool IsTriggerResponding() const;
355  void SetTriggerResponding(bool triggerResponding);
366  bool IsValid(WifiPhyBand band = WIFI_PHY_BAND_UNSPECIFIED) const;
370  bool IsMu() const;
375  bool IsDlMu() const;
380  bool IsUlMu() const;
386  bool IsDlOfdma() const;
392  bool IsDlMuMimo() const;
398  bool IsAllocated(uint16_t staId) const;
406  HeRu::RuSpec GetRu(uint16_t staId) const;
414  void SetRu(HeRu::RuSpec ru, uint16_t staId);
422  HeMuUserInfo GetHeMuUserInfo(uint16_t staId) const;
430  void SetHeMuUserInfo(uint16_t staId, HeMuUserInfo userInfo);
437  const HeMuUserInfoMap& GetHeMuUserInfoMap() const;
445 
447  using UserInfoMapOrderedByRus = std::map<HeRu::RuSpec, std::set<uint16_t>, HeRu::RuSpecCompare>;
448 
455  UserInfoMapOrderedByRus GetUserInfoMapOrderedByRus(uint8_t p20Index) const;
456 
462  bool IsSigBCompression() const;
463 
471  void SetInactiveSubchannels(const std::vector<bool>& inactiveSubchannels);
479  const std::vector<bool>& GetInactiveSubchannels() const;
480 
485  void SetSigBMode(const WifiMode& mode);
486 
491  WifiMode GetSigBMode() const;
492 
498  void SetRuAllocation(const RuAllocation& ruAlloc, uint8_t p20Index);
499 
505  const RuAllocation& GetRuAllocation(uint8_t p20Index) const;
506 
511  void SetCenter26ToneRuIndication(Center26ToneRuIndication center26ToneRuIndication);
512 
519  std::optional<Center26ToneRuIndication> GetCenter26ToneRuIndication() const;
520 
525  void SetEhtPpduType(uint8_t type);
530  uint8_t GetEhtPpduType() const;
531 
532  private:
542  RuAllocation DeriveRuAllocation(uint8_t p20Index) const;
543 
552 
559  uint8_t GetNumStasInRu(const HeRu::RuSpec& ru) const;
560 
564  uint8_t m_txPowerLevel;
568  uint16_t m_channelWidth;
569  uint16_t m_guardInterval;
570  uint8_t m_nTx;
571  uint8_t m_nss;
572  uint8_t m_ness;
574  bool m_stbc;
575  bool m_ldpc;
576  uint8_t m_bssColor;
577  uint16_t m_length;
582  // MU information
587  std::vector<bool>
595  mutable std::optional<Center26ToneRuIndication>
600  uint8_t m_ehtPpduType;
601 };
602 
611 std::ostream& operator<<(std::ostream& os, const WifiTxVector& v);
612 
613 } // namespace ns3
614 
615 #endif /* WIFI_TX_VECTOR_H */
RU Specification.
Definition: he-ru.h:66
represent a single transmission mode
Definition: wifi-mode.h:51
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint16_t m_channelWidth
channel width in MHz
void SetCenter26ToneRuIndication(Center26ToneRuIndication center26ToneRuIndication)
Set CENTER_26_TONE_RU field.
void SetRuAllocation(const RuAllocation &ruAlloc, uint8_t p20Index)
Set RU_ALLOCATION field.
void SetStbc(bool stbc)
Sets if STBC is being used.
void SetNess(uint8_t ness)
Sets the Ness number.
UserInfoMapOrderedByRus GetUserInfoMapOrderedByRus(uint8_t p20Index) const
Get the map of specific user info parameters ordered per increasing frequency RUs.
bool IsTriggerResponding() const
Return true if the Trigger Responding parameter is set to true, false otherwise.
bool m_aggregation
Flag whether the PSDU contains A-MPDU.
void SetEhtPpduType(uint8_t type)
Set the EHT_PPDU_TYPE parameter.
uint8_t GetNumStasInRu(const HeRu::RuSpec &ru) const
Get the number of STAs in a given RU.
uint16_t GetGuardInterval() const
bool IsSigBCompression() const
Indicate whether the Common field is present in the HE-SIG-B field.
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
void SetLdpc(bool ldpc)
Sets if LDPC FEC coding is being used.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
uint8_t GetBssColor() const
Get the BSS color.
bool GetModeInitialized() const
const RuAllocation & GetRuAllocation(uint8_t p20Index) const
Get RU_ALLOCATION field.
std::optional< Center26ToneRuIndication > m_center26ToneRuIndication
CENTER_26_TONE_RU field when format is HE_MU and when channel width is set to 80 MHz or larger (Table...
std::vector< bool > m_inactiveSubchannels
Bitmap of inactive subchannels used for preamble puncturing.
WifiMode m_mode
The DATARATE parameter in Table 15-4.
std::map< uint16_t, HeMuUserInfo > HeMuUserInfoMap
map of HE MU specific user info parameters indexed by STA-ID
uint8_t GetNTx() const
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
bool IsValid(WifiPhyBand band=WIFI_PHY_BAND_UNSPECIFIED) const
The standard disallows certain combinations of WifiMode, number of spatial streams,...
std::optional< Center26ToneRuIndication > GetCenter26ToneRuIndication() const
Get CENTER_26_TONE_RU field This field is present if format is HE_MU and when channel width is set to...
void SetTriggerResponding(bool triggerResponding)
Set the Trigger Responding parameter to the given value.
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
RuAllocation m_ruAllocation
RU allocations that are going to be carried in SIG-B common field per Table 27-1 IEEE.
void SetInactiveSubchannels(const std::vector< bool > &inactiveSubchannels)
Set the 20 MHz subchannels that are punctured.
bool IsStbc() const
Check if STBC is used or not.
void SetHeMuUserInfo(uint16_t staId, HeMuUserInfo userInfo)
Set the HE MU user-specific transmission information for the given STA-ID.
WifiPreamble GetPreambleType() const
HeMuUserInfo GetHeMuUserInfo(uint16_t staId) const
Get the HE MU user-specific transmission information for the given STA-ID.
uint8_t m_nTx
number of TX antennas
bool m_triggerResponding
The Trigger Responding parameter.
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
HeRu::RuSpec GetRu(uint16_t staId) const
Get the RU specification for the STA-ID.
HeMuUserInfoMap m_muUserInfos
HE MU specific per-user information indexed by station ID (STA-ID) corresponding to the 11 LSBs of th...
uint8_t m_txPowerLevel
The TXPWR_LEVEL parameter in Table 15-4.
bool m_ldpc
LDPC FEC coding if true, BCC otherwise.
uint16_t GetLength() const
Get the LENGTH field of the L-SIG.
uint16_t m_guardInterval
guard interval duration in nanoseconds
bool IsDlMu() const
bool m_stbc
STBC used or not.
uint8_t m_nss
number of spatial streams
uint8_t GetNssTotal() const
const HeMuUserInfoMap & GetHeMuUserInfoMap() const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
void SetRu(HeRu::RuSpec ru, uint16_t staId)
Set the RU specification for the STA-ID.
uint8_t GetEhtPpduType() const
Get the EHT_PPDU_TYPE parameter.
bool IsDlOfdma() const
Return true if this TX vector is used for a downlink multi-user transmission using OFDMA.
WifiModulationClass GetModulationClass() const
Get the modulation class specified by this TXVECTOR.
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
void SetLength(uint16_t length)
Set the LENGTH field of the L-SIG.
uint8_t GetNssMax() const
bool IsUlMu() const
void SetSigBMode(const WifiMode &mode)
Set the MCS used for SIG-B.
uint16_t m_length
LENGTH field of the L-SIG.
uint8_t m_bssColor
BSS color.
WifiMode m_sigBMcs
MCS_SIG_B per Table 27-1 IEEE 802.11ax-2021.
void SetBssColor(uint8_t color)
Set the BSS color.
bool IsLdpc() const
Check if LDPC FEC coding is used or not.
void SetNTx(uint8_t nTx)
Sets the number of TX antennas.
uint8_t GetTxPowerLevel() const
std::map< HeRu::RuSpec, std::set< uint16_t >, HeRu::RuSpecCompare > UserInfoMapOrderedByRus
map of specific user info parameters ordered per increasing frequency RUs
bool IsAggregation() const
Checks whether the PSDU contains A-MPDU.
uint8_t m_ehtPpduType
EHT_PPDU_TYPE per Table 36-1 IEEE 802.11be D2.3.
bool IsAllocated(uint16_t staId) const
Check if STA ID is allocated.
uint16_t GetChannelWidth() const
WifiPreamble m_preamble
preamble
Center26ToneRuIndication DeriveCenter26ToneRuIndication() const
Derive the CENTER_26_TONE_RU field from the TXVECTOR for which its CENTER_26_TONE_RU has not been set...
RuAllocation DeriveRuAllocation(uint8_t p20Index) const
Derive the RU_ALLOCATION field from the TXVECTOR for which its RU_ALLOCATION field has not been set y...
bool m_modeInitialized
Internal initialization flag.
bool IsDlMuMimo() const
Return true if this TX vector is used for a downlink multi-user transmission using MU-MIMO.
uint8_t GetNess() const
uint8_t m_ness
number of spatial streams in beamforming
bool IsNonHtDuplicate() const
Checks whether this TXVECTOR corresponds to a non-HT duplicate.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
WifiMode GetSigBMode() const
Get MCS used for SIG-B.
void SetNss(uint8_t nss)
Sets the number of Nss.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
const std::vector< bool > & GetInactiveSubchannels() const
Get the 20 MHz subchannels that are punctured.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Center26ToneRuIndication
Enum for the different values for CENTER_26_TONE_RU.
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
@ CENTER_26_TONE_RU_LOW_AND_HIGH_80_MHZ_ALLOCATED
@ CENTER_26_TONE_RU_UNALLOCATED
@ CENTER_26_TONE_RU_HIGH_80_MHZ_ALLOCATED
@ CENTER_26_TONE_RU_LOW_80_MHZ_ALLOCATED
@ CENTER_26_TONE_RU_INDICATION_MAX
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
Definition: wifi-phy-band.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint16_t NO_USER_STA_ID
STA_ID for a RU that is intended for no user (Section 26.11.1 802.11ax-2021)
std::vector< uint8_t > RuAllocation
8 bit RU_ALLOCATION per 20 MHz
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition: wifi-mode.h:35
HE MU specific user transmission parameters.
uint8_t mcs
MCS index.
HeRu::RuSpec ru
RU specification.
uint8_t nss
number of spatial streams
bool operator!=(const HeMuUserInfo &other) const
Compare this user info to the given user info.
bool operator==(const HeMuUserInfo &other) const
Compare this user info to the given user info.
Struct providing a function call operator to compare two RUs.
Definition: he-ru.h:141
Declaration of the following enums: