wifi: Add INACTIVE_SUBCHANNELS to TXVECTOR for preamble puncturing

This commit is contained in:
Sebastien Deronne
2022-07-16 10:58:03 +02:00
parent 3c2cb309db
commit 4d3bcef366
2 changed files with 49 additions and 2 deletions

View File

@@ -22,6 +22,8 @@
#include "wifi-tx-vector.h"
#include "wifi-phy-common.h"
#include "ns3/abort.h"
#include <algorithm>
#include <iterator>
namespace ns3 {
@@ -67,7 +69,8 @@ WifiTxVector::WifiTxVector (WifiMode mode,
m_ldpc (ldpc),
m_bssColor (bssColor),
m_length (length),
m_modeInitialized (true)
m_modeInitialized (true),
m_inactiveSubchannels ()
{
}
@@ -85,7 +88,8 @@ WifiTxVector::WifiTxVector (const WifiTxVector& txVector)
m_ldpc (txVector.m_ldpc),
m_bssColor (txVector.m_bssColor),
m_length (txVector.m_length),
m_modeInitialized (txVector.m_modeInitialized)
m_modeInitialized (txVector.m_modeInitialized),
m_inactiveSubchannels (txVector.m_inactiveSubchannels)
{
m_muUserInfos.clear ();
if (!txVector.m_muUserInfos.empty ()) //avoids crashing for loop
@@ -498,6 +502,24 @@ WifiTxVector::GetNumRusPerHeSigBContentChannel (void) const
return std::make_pair (numRusContentChannel1, numRusContentChannel2);
}
void
WifiTxVector::SetInactiveSubchannels (const std::vector<bool>& inactiveSubchannels)
{
NS_ABORT_MSG_IF (m_preamble < WIFI_PREAMBLE_HE_SU,
"Only HE (or later) authorized for preamble puncturing");
NS_ABORT_MSG_IF (m_channelWidth < 80,
"Preamble puncturing only possible for transmission bandwidth of 80 MHz or larger");
NS_ABORT_MSG_IF (inactiveSubchannels.size () != (m_channelWidth / 20),
"The size of the inactive subchannnels bitmap should be equal to the number of 20 MHz subchannels");
m_inactiveSubchannels = inactiveSubchannels;
}
const std::vector<bool>&
WifiTxVector::GetInactiveSubchannels (void) const
{
return m_inactiveSubchannels;
}
std::ostream & operator << ( std::ostream &os, const WifiTxVector &v)
{
if (!v.IsValid ())
@@ -539,6 +561,13 @@ std::ostream & operator << ( std::ostream &os, const WifiTxVector &v)
os << " mode: " << v.GetMode ()
<< " Nss: " << +v.GetNss ();
}
const auto& puncturedSubchannels = v.GetInactiveSubchannels ();
if (!puncturedSubchannels.empty ())
{
os << " Punctured subchannels: ";
std::copy (puncturedSubchannels.cbegin (), puncturedSubchannels.cend(),
std::ostream_iterator<bool>(os, ", "));
}
return os;
}

View File

@@ -23,6 +23,7 @@
#define WIFI_TX_VECTOR_H
#include <list>
#include <vector>
#include "wifi-mode.h"
#include "wifi-phy-common.h"
#include "ns3/he-ru.h"
@@ -388,6 +389,22 @@ public:
*/
std::pair<std::size_t, std::size_t> GetNumRusPerHeSigBContentChannel (void) const;
/**
* Set the 20 MHz subchannels that are punctured.
*
* \param inactiveSubchannels the bitmap indexed by the 20 MHz subchannels in ascending order,
* where each bit indicates whether the corresponding 20 MHz subchannel is punctured or not
* within the transmission bandwidth
*/
void SetInactiveSubchannels (const std::vector<bool>& inactiveSubchannels);
/**
* Get the 20 MHz subchannels that are punctured.
*
* \return the bitmap indexed by the 20 MHz subchannels in ascending order,
* where each bit indicates whether the corresponding 20 MHz subchannel is punctured or not
* within the transmission bandwidth
*/
const std::vector<bool>& GetInactiveSubchannels (void) const;
private:
WifiMode m_mode; /**< The DATARATE parameter in Table 15-4.
@@ -415,6 +432,7 @@ private:
indexed by station ID (STA-ID) corresponding
to the 11 LSBs of the AID of the recipient STA
This list shall be used only for HE MU */
std::vector<bool> m_inactiveSubchannels;/**< Bitmap of inactive subchannels used for preamble puncturing */
};
/**