A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
eht-ppdu.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 DERONNE SOFTWARE ENGINEERING
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: Sébastien Deronne <sebastien.deronne@gmail.com>
18 */
19
20#include "eht-ppdu.h"
21
22#include "eht-phy.h"
23
24#include "ns3/log.h"
25#include "ns3/wifi-psdu.h"
26
27namespace ns3
28{
29
31
33 const WifiTxVector& txVector,
34 uint16_t txCenterFreq,
35 Time ppduDuration,
36 WifiPhyBand band,
37 uint64_t uid,
38 TxPsdFlag flag)
39 : HePpdu(psdus, txVector, txCenterFreq, ppduDuration, band, uid, flag)
40{
41 NS_LOG_FUNCTION(this << psdus << txVector << txCenterFreq << ppduDuration << band << uid
42 << flag);
43
44 // For EHT SU transmissions (carried in EHT MU PPDUs), we have to:
45 // - store the EHT-SIG content channels
46 // - store the MCS and the number of streams for the data field
47 // because this is not done by the parent class.
48 // This is a workaround needed until we properly implement 11be PHY headers.
49 if (ns3::IsDlMu(m_preamble) && !txVector.IsDlMu())
50 {
53 m_ehtSuMcs = txVector.GetMode().GetMcsValue();
54 m_ehtSuNStreams = txVector.GetNss();
55 }
56}
57
60{
61 if (m_muUserInfos.empty())
62 {
63 return WIFI_PPDU_TYPE_SU;
64 }
65 switch (m_preamble)
66 {
71 default:
72 NS_ASSERT_MSG(false, "invalid preamble " << m_preamble);
73 return WIFI_PPDU_TYPE_SU;
74 }
75}
76
77bool
79{
80 return (m_preamble == WIFI_PREAMBLE_EHT_MU) && !m_muUserInfos.empty();
81}
82
83bool
85{
86 return (m_preamble == WIFI_PREAMBLE_EHT_TB) && !m_muUserInfos.empty();
87}
88
89void
91 const LSigHeader& lSig,
92 const HeSigHeader& heSig) const
93{
95 txVector.SetChannelWidth(heSig.GetChannelWidth());
96 txVector.SetNss(m_ehtSuNStreams);
97 txVector.SetGuardInterval(heSig.GetGuardInterval());
98 txVector.SetBssColor(heSig.GetBssColor());
99 txVector.SetLength(lSig.GetLength());
100 txVector.SetAggregation(m_psdus.size() > 1 || m_psdus.begin()->second->IsAggregate());
101 if (!m_muUserInfos.empty())
102 {
103 txVector.SetEhtPpduType(0); // FIXME set to 2 for DL MU-MIMO (non-OFDMA) transmission
104 }
105 for (const auto& muUserInfo : m_muUserInfos)
106 {
107 txVector.SetHeMuUserInfo(muUserInfo.first, muUserInfo.second);
108 }
110 {
111 txVector.SetSigBMode(HePhy::GetVhtMcs(heSig.GetMcs()));
113 }
114}
115
118{
119 return Ptr<WifiPpdu>(new EhtPpdu(*this), false);
120}
121
122} // namespace ns3
static WifiMode GetEhtMcs(uint8_t index)
Return the EHT MCS corresponding to the provided index.
Definition: eht-phy.cc:226
EHT PPDU (11be)
Definition: eht-ppdu.h:41
EhtPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, uint16_t txCenterFreq, Time ppduDuration, WifiPhyBand band, uint64_t uid, TxPsdFlag flag)
Create an EHT PPDU, storing a map of PSDUs.
Definition: eht-ppdu.cc:32
bool IsDlMu() const override
Return true if the PPDU is a DL MU PPDU.
Definition: eht-ppdu.cc:78
bool IsUlMu() const override
Return true if the PPDU is an UL MU PPDU.
Definition: eht-ppdu.cc:84
uint8_t m_ehtSuMcs
EHT-MCS for EHT SU transmissions.
Definition: eht-ppdu.h:74
uint8_t m_ehtSuNStreams
Number of streams for EHT SU transmissions.
Definition: eht-ppdu.h:75
Ptr< WifiPpdu > Copy() const override
Copy this instance.
Definition: eht-ppdu.cc:117
WifiPpduType GetType() const override
Return the PPDU type (.
Definition: eht-ppdu.cc:59
void SetTxVectorFromPhyHeaders(WifiTxVector &txVector, const LSigHeader &lSig, const HeSigHeader &heSig) const override
Fill in the TXVECTOR from PHY headers.
Definition: eht-ppdu.cc:90
HE-SIG PHY header (HE-SIG-A1/A2/B)
Definition: he-ppdu.h:51
uint16_t GetGuardInterval() const
Return the guard interval (in nanoseconds).
Definition: he-ppdu.cc:592
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
uint16_t GetChannelWidth() const
Return the channel width (in MHz).
Definition: he-ppdu.cc:550
HE PPDU (11ax)
Definition: he-ppdu.h:45
TxPsdFlag
The transmit power spectral density flag, namely used to correctly build PSDs for pre-HE and HE porti...
Definition: he-ppdu.h:156
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
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
OFDM and ERP OFDM L-SIG PHY header.
Definition: ofdm-ppdu.h:55
uint16_t GetLength() const
Return the LENGTH field of L-SIG (in bytes).
Definition: ofdm-ppdu.cc:264
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:344
uint8_t GetMcsValue() const
Definition: wifi-mode.cc:163
WifiPreamble m_preamble
the PHY preamble
Definition: wifi-ppdu.h:201
WifiConstPsduMap m_psdus
the PSDUs contained in this PPDU
Definition: wifi-ppdu.h:203
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetEhtPpduType(uint8_t type)
Set the EHT_PPDU_TYPE parameter.
const RuAllocation & GetRuAllocation() const
Get RU Allocation of SIG-B.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
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.
void SetHeMuUserInfo(uint16_t staId, HeMuUserInfo userInfo)
Set the HE MU user-specific transmission information for the given STA-ID.
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
bool IsDlMu() const
void SetRuAllocation(const RuAllocation &ruAlloc)
Set RU Allocation of SIG-B common field.
ContentChannelAllocation GetContentChannelAllocation() const
Get the HE SIG-B content channel STA ID allocation IEEE 802.11ax-2021 27.3.11.8.2 HE-SIG-B content ch...
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.
void SetSigBMode(const WifiMode &mode)
Set the MCS used for SIG-B.
void SetBssColor(uint8_t color)
Set the BSS color.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss.
Declaration of ns3::EhtPhy class.
Declaration of ns3::EhtPpdu class.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
@ WIFI_PREAMBLE_EHT_TB
@ WIFI_PREAMBLE_EHT_MU
@ WIFI_PPDU_TYPE_DL_MU
@ WIFI_PPDU_TYPE_UL_MU
@ WIFI_PPDU_TYPE_SU
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.
bool IsDlMu(WifiPreamble preamble)
Return true if a preamble corresponds to a downlink multi-user transmission.