wifi: Pass operating channel to WifiPpdu

This commit is contained in:
Sébastien Deronne
2023-03-23 19:01:43 +01:00
committed by Sebastien Deronne
parent a133d4c04d
commit db2be4a9d9
30 changed files with 252 additions and 244 deletions

View File

@@ -160,10 +160,8 @@ EhtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, T
NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
return Create<EhtPpdu>(psdus,
txVector,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
txVector.GetChannelWidth()),
m_wifiPhy->GetOperatingChannel(),
ppduDuration,
m_wifiPhy->GetPhyBand(),
ObtainNextUid(txVector),
HePpdu::PSD_NON_HE_PORTION);
}

View File

@@ -22,6 +22,7 @@
#include "eht-phy.h"
#include "ns3/log.h"
#include "ns3/wifi-phy-operating-channel.h"
#include "ns3/wifi-psdu.h"
namespace ns3
@@ -31,15 +32,13 @@ NS_LOG_COMPONENT_DEFINE("EhtPpdu");
EhtPpdu::EhtPpdu(const WifiConstPsduMap& psdus,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid,
TxPsdFlag flag)
: HePpdu(psdus, txVector, txCenterFreq, ppduDuration, band, uid, flag)
: HePpdu(psdus, txVector, channel, ppduDuration, uid, flag)
{
NS_LOG_FUNCTION(this << psdus << txVector << txCenterFreq << ppduDuration << band << uid
<< flag);
NS_LOG_FUNCTION(this << psdus << txVector << channel << ppduDuration << uid << flag);
// For EHT SU transmissions (carried in EHT MU PPDUs), we have to:
// - store the EHT-SIG content channels

View File

@@ -47,17 +47,15 @@ class EhtPpdu : public HePpdu
*
* \param psdus the PHY payloads (PSDUs)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param ppduDuration the transmission duration of this PPDU
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU or of the triggering PPDU if this is an EHT TB PPDU
* \param flag the flag indicating the type of Tx PSD to build
*/
EhtPpdu(const WifiConstPsduMap& psdus,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid,
TxPsdFlag flag);

View File

@@ -339,10 +339,8 @@ HePhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, Ti
NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
return Create<HePpdu>(psdus,
txVector,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
txVector.GetChannelWidth()),
m_wifiPhy->GetOperatingChannel(),
ppduDuration,
m_wifiPhy->GetPhyBand(),
ObtainNextUid(txVector),
HePpdu::PSD_NON_HE_PORTION);
}

View File

@@ -24,6 +24,7 @@
#include "he-phy.h"
#include "ns3/log.h"
#include "ns3/wifi-phy-operating-channel.h"
#include "ns3/wifi-phy.h"
#include "ns3/wifi-psdu.h"
#include "ns3/wifi-utils.h"
@@ -50,20 +51,18 @@ operator<<(std::ostream& os, const HePpdu::TxPsdFlag& flag)
HePpdu::HePpdu(const WifiConstPsduMap& psdus,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid,
TxPsdFlag flag)
: OfdmPpdu(psdus.begin()->second,
txVector,
txCenterFreq,
band,
channel,
uid,
false) // don't instantiate LSigHeader of OfdmPpdu
false), // don't instantiate LSigHeader of OfdmPpdu
m_txPsdFlag(flag)
{
NS_LOG_FUNCTION(this << psdus << txVector << txCenterFreq << ppduDuration << band << uid
<< flag);
NS_LOG_FUNCTION(this << psdus << txVector << channel << ppduDuration << uid << flag);
// overwrite with map (since only first element used by OfdmPpdu)
m_psdus.begin()->second = nullptr;
@@ -85,18 +84,16 @@ HePpdu::HePpdu(const WifiConstPsduMap& psdus,
HePpdu::HePpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid)
: OfdmPpdu(psdu,
txVector,
txCenterFreq,
band,
channel,
uid,
false) // don't instantiate LSigHeader of OfdmPpdu
{
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << band << uid);
NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid);
NS_ASSERT(!IsMu());
SetPhyHeaders(txVector, ppduDuration);
SetTxPsdFlag(PSD_NON_HE_PORTION);
@@ -126,7 +123,8 @@ void
HePpdu::SetLSigHeader(LSigHeader& lSig, Time ppduDuration) const
{
uint8_t sigExtension = 0;
if (m_band == WIFI_PHY_BAND_2_4GHZ)
NS_ASSERT(m_operatingChannel.IsSet());
if (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ)
{
sigExtension = 6;
}
@@ -240,7 +238,8 @@ HePpdu::GetTxDuration() const
Time tSymbol = NanoSeconds(12800 + txVector.GetGuardInterval());
Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector);
uint8_t sigExtension = 0;
if (m_band == WIFI_PHY_BAND_2_4GHZ)
NS_ASSERT(m_operatingChannel.IsSet());
if (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ)
{
sigExtension = 6;
}

View File

@@ -163,16 +163,14 @@ class HePpdu : public OfdmPpdu
*
* \param psdu the PHY payload (PSDU)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param ppduDuration the transmission duration of this PPDU
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU
*/
HePpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid);
/**
* Create an MU HE PPDU, storing a map of PSDUs.
@@ -181,17 +179,15 @@ class HePpdu : public OfdmPpdu
*
* \param psdus the PHY payloads (PSDUs)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param ppduDuration the transmission duration of this PPDU
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU or of the triggering PPDU if this is an HE TB PPDU
* \param flag the flag indicating the type of Tx PSD to build
*/
HePpdu(const WifiConstPsduMap& psdus,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid,
TxPsdFlag flag);

View File

@@ -381,10 +381,8 @@ HtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, Ti
NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
return Create<HtPpdu>(psdus.begin()->second,
txVector,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
txVector.GetChannelWidth()),
m_wifiPhy->GetOperatingChannel(),
ppduDuration,
m_wifiPhy->GetPhyBand(),
ObtainNextUid(txVector));
}

View File

@@ -24,6 +24,7 @@
#include "ht-phy.h"
#include "ns3/log.h"
#include "ns3/wifi-phy-operating-channel.h"
#include "ns3/wifi-phy.h"
#include "ns3/wifi-psdu.h"
#include "ns3/wifi-utils.h"
@@ -35,18 +36,16 @@ NS_LOG_COMPONENT_DEFINE("HtPpdu");
HtPpdu::HtPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid)
: OfdmPpdu(psdu,
txVector,
txCenterFreq,
band,
channel,
uid,
false) // don't instantiate LSigHeader of OfdmPpdu
{
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << band << uid);
NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid);
SetPhyHeaders(txVector, ppduDuration, psdu->GetSize());
}
@@ -74,7 +73,8 @@ void
HtPpdu::SetLSigHeader(LSigHeader& lSig, Time ppduDuration) const
{
uint8_t sigExtension = 0;
if (m_band == WIFI_PHY_BAND_2_4GHZ)
NS_ASSERT(m_operatingChannel.IsSet());
if (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ)
{
sigExtension = 6;
}
@@ -158,7 +158,9 @@ HtPpdu::GetTxDuration() const
htLength = m_htSig.GetHtLength();
#endif
ppduDuration = WifiPhy::CalculateTxDuration(htLength, txVector, m_band);
NS_ASSERT(m_operatingChannel.IsSet());
ppduDuration =
WifiPhy::CalculateTxDuration(htLength, txVector, m_operatingChannel.GetPhyBand());
return ppduDuration;
}

View File

@@ -139,16 +139,14 @@ class HtPpdu : public OfdmPpdu
*
* \param psdu the PHY payload (PSDU)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param ppduDuration the transmission duration of this PPDU
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU
*/
HtPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid);
Time GetTxDuration() const override;

View File

@@ -28,6 +28,7 @@
#include "ns3/log.h"
#include "ns3/packet.h"
#include "ns3/simulator.h"
#include "ns3/wifi-phy-operating-channel.h"
#include <algorithm>
#include <numeric>
@@ -232,8 +233,9 @@ InterferenceHelper::AddForeignSignal(Time duration, RxPowerWattPerChannelBand& r
WifiMacHeader hdr;
hdr.SetType(WIFI_MAC_QOSDATA);
hdr.SetQosTid(0);
Ptr<WifiPpdu> fakePpdu =
Create<WifiPpdu>(Create<WifiPsdu>(Create<Packet>(0), hdr), WifiTxVector(), 0);
Ptr<WifiPpdu> fakePpdu = Create<WifiPpdu>(Create<WifiPsdu>(Create<Packet>(0), hdr),
WifiTxVector(),
WifiPhyOperatingChannel());
Add(fakePpdu, WifiTxVector(), duration, rxPowerW);
}

View File

@@ -200,8 +200,7 @@ DsssPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector,
NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
return Create<DsssPpdu>(psdus.begin()->second,
txVector,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
txVector.GetChannelWidth()),
m_wifiPhy->GetOperatingChannel(),
ppduDuration,
ObtainNextUid(txVector));
}

View File

@@ -24,6 +24,7 @@
#include "dsss-phy.h"
#include "ns3/log.h"
#include "ns3/wifi-phy-operating-channel.h"
#include "ns3/wifi-phy.h"
#include "ns3/wifi-psdu.h"
@@ -34,12 +35,12 @@ NS_LOG_COMPONENT_DEFINE("DsssPpdu");
DsssPpdu::DsssPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
uint64_t uid)
: WifiPpdu(psdu, txVector, txCenterFreq, uid)
: WifiPpdu(psdu, txVector, channel, uid)
{
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << uid);
NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid);
SetPhyHeaders(txVector, ppduDuration);
}

View File

@@ -101,13 +101,13 @@ class DsssPpdu : public WifiPpdu
*
* \param psdu the PHY payload (PSDU)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param ppduDuration the transmission duration of this PPDU
* \param uid the unique ID of this PPDU
*/
DsssPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
uint64_t uid);

View File

@@ -116,9 +116,7 @@ ErpOfdmPhy::BuildPpdu(const WifiConstPsduMap& psdus,
return Create<ErpOfdmPpdu>(
psdus.begin()->second,
txVector,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
txVector.GetChannelWidth()),
m_wifiPhy->GetPhyBand(),
m_wifiPhy->GetOperatingChannel(),
m_wifiPhy->GetLatestPhyEntity()->ObtainNextUid(
txVector)); // use latest PHY entity to handle MU-RTS sent with non-HT rate
}

View File

@@ -23,6 +23,7 @@
#include "erp-ofdm-phy.h"
#include "ns3/log.h"
#include "ns3/wifi-phy-operating-channel.h"
#include "ns3/wifi-psdu.h"
namespace ns3
@@ -32,12 +33,11 @@ NS_LOG_COMPONENT_DEFINE("ErpOfdmPpdu");
ErpOfdmPpdu::ErpOfdmPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
WifiPhyBand band,
const WifiPhyOperatingChannel& channel,
uint64_t uid)
: OfdmPpdu(psdu, txVector, txCenterFreq, band, uid, true) // add LSigHeader of OfdmPpdu
: OfdmPpdu(psdu, txVector, channel, uid, true) // add LSigHeader of OfdmPpdu
{
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << band << uid);
NS_LOG_FUNCTION(this << psdu << txVector << channel << uid);
}
void

View File

@@ -49,14 +49,12 @@ class ErpOfdmPpdu : public OfdmPpdu
*
* \param psdu the PHY payload (PSDU)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param uid the unique ID of this PPDU
*/
ErpOfdmPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
WifiPhyBand band,
const WifiPhyOperatingChannel& channel,
uint64_t uid);
Ptr<WifiPpdu> Copy() const override;

View File

@@ -298,9 +298,7 @@ OfdmPhy::BuildPpdu(const WifiConstPsduMap& psdus,
return Create<OfdmPpdu>(
psdus.begin()->second,
txVector,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
txVector.GetChannelWidth()),
m_wifiPhy->GetPhyBand(),
m_wifiPhy->GetOperatingChannel(),
m_wifiPhy->GetLatestPhyEntity()->ObtainNextUid(
txVector)); // use latest PHY entity to handle MU-RTS sent with non-HT rate
}

View File

@@ -24,6 +24,7 @@
#include "ofdm-phy.h"
#include "ns3/log.h"
#include "ns3/wifi-phy-operating-channel.h"
#include "ns3/wifi-phy.h"
#include "ns3/wifi-psdu.h"
@@ -34,15 +35,13 @@ NS_LOG_COMPONENT_DEFINE("OfdmPpdu");
OfdmPpdu::OfdmPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
WifiPhyBand band,
const WifiPhyOperatingChannel& channel,
uint64_t uid,
bool instantiateLSig /* = true */)
: WifiPpdu(psdu, txVector, txCenterFreq, uid),
m_band(band),
: WifiPpdu(psdu, txVector, channel, uid),
m_channelWidth(txVector.IsNonHtDuplicate() ? 20 : txVector.GetChannelWidth())
{
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << band << uid);
NS_LOG_FUNCTION(this << psdu << txVector << channel << uid);
if (instantiateLSig)
{
SetPhyHeaders(txVector, psdu->GetSize());
@@ -112,7 +111,8 @@ OfdmPpdu::GetTxDuration() const
#else
length = m_lSig.GetLength();
#endif
return WifiPhy::CalculateTxDuration(length, txVector, m_band);
NS_ASSERT(m_operatingChannel.IsSet());
return WifiPhy::CalculateTxDuration(length, txVector, m_operatingChannel.GetPhyBand());
}
Ptr<WifiPpdu>

View File

@@ -105,16 +105,14 @@ class OfdmPpdu : public WifiPpdu
*
* \param psdu the PHY payload (PSDU)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param uid the unique ID of this PPDU
* \param instantiateLSig flag used to instantiate LSigHeader (set LSigHeader's
* rate and length), should be disabled by child classes
*/
OfdmPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
WifiPhyBand band,
const WifiPhyOperatingChannel& channel,
uint64_t uid,
bool instantiateLSig = true);
@@ -122,7 +120,6 @@ class OfdmPpdu : public WifiPpdu
Ptr<WifiPpdu> Copy() const override;
protected:
WifiPhyBand m_band; //!< the WifiPhyBand used to transmit that PPDU
#ifndef NS3_BUILD_PROFILE_DEBUG
LSigHeader m_lSig; //!< the L-SIG PHY header
#endif

View File

@@ -246,8 +246,7 @@ PhyEntity::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector
"version in the amendment-specific subclasses instead!");
return Create<WifiPpdu>(psdus.begin()->second,
txVector,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
txVector.GetChannelWidth())); // should be overloaded
m_wifiPhy->GetOperatingChannel()); // should be overloaded
}
Time

View File

@@ -250,10 +250,8 @@ VhtPhy::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, T
NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
return Create<VhtPpdu>(psdus.begin()->second,
txVector,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(
txVector.GetChannelWidth()),
m_wifiPhy->GetOperatingChannel(),
ppduDuration,
m_wifiPhy->GetPhyBand(),
ObtainNextUid(txVector));
}

View File

@@ -24,6 +24,7 @@
#include "vht-phy.h"
#include "ns3/log.h"
#include "ns3/wifi-phy-operating-channel.h"
#include "ns3/wifi-phy.h"
#include "ns3/wifi-psdu.h"
@@ -34,18 +35,16 @@ NS_LOG_COMPONENT_DEFINE("VhtPpdu");
VhtPpdu::VhtPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid)
: OfdmPpdu(psdu,
txVector,
txCenterFreq,
band,
channel,
uid,
false) // don't instantiate LSigHeader of OfdmPpdu
{
NS_LOG_FUNCTION(this << psdu << txVector << txCenterFreq << ppduDuration << band << uid);
NS_LOG_FUNCTION(this << psdu << txVector << channel << ppduDuration << uid);
SetPhyHeaders(txVector, ppduDuration);
}

View File

@@ -23,6 +23,7 @@
#define VHT_PPDU_H
#include "ns3/ofdm-ppdu.h"
#include "ns3/wifi-phy-operating-channel.h"
/**
* \file
@@ -153,16 +154,14 @@ class VhtPpdu : public OfdmPpdu
*
* \param psdu the PHY payload (PSDU)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param ppduDuration the transmission duration of this PPDU
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU
*/
VhtPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
Time ppduDuration,
WifiPhyBand band,
uint64_t uid);
Time GetTxDuration() const override;

View File

@@ -23,6 +23,7 @@
#include "ns3/log.h"
#include "ns3/packet.h"
#include "ns3/wifi-phy-operating-channel.h"
namespace ns3
{
@@ -31,33 +32,39 @@ NS_LOG_COMPONENT_DEFINE("WifiPpdu");
WifiPpdu::WifiPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
uint64_t uid /* = UINT64_MAX */)
: m_preamble(txVector.GetPreambleType()),
m_modulation(txVector.IsValid() ? txVector.GetModulationClass() : WIFI_MOD_CLASS_UNKNOWN),
m_txCenterFreq(txCenterFreq),
m_txCenterFreq(channel.IsSet()
? channel.GetPrimaryChannelCenterFrequency(txVector.GetChannelWidth())
: 0),
m_uid(uid),
m_txVector(txVector),
m_operatingChannel(channel),
#ifdef NS3_BUILD_PROFILE_DEBUG
m_phyHeaders(Create<Packet>()),
#endif
m_truncatedTx(false),
m_txPowerLevel(txVector.GetTxPowerLevel())
{
NS_LOG_FUNCTION(this << *psdu << txVector << txCenterFreq << uid);
NS_LOG_FUNCTION(this << *psdu << txVector << channel << uid);
m_psdus.insert(std::make_pair(SU_STA_ID, psdu));
}
WifiPpdu::WifiPpdu(const WifiConstPsduMap& psdus,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
uint64_t uid)
: m_preamble(txVector.GetPreambleType()),
m_modulation(txVector.IsValid() ? txVector.GetMode(psdus.begin()->first).GetModulationClass()
: WIFI_MOD_CLASS_UNKNOWN),
m_txCenterFreq(txCenterFreq),
m_txCenterFreq(channel.IsSet()
? channel.GetPrimaryChannelCenterFrequency(txVector.GetChannelWidth())
: 0),
m_uid(uid),
m_txVector(txVector),
m_operatingChannel(channel),
#ifdef NS3_BUILD_PROFILE_DEBUG
m_phyHeaders(Create<Packet>()),
#endif
@@ -65,7 +72,7 @@ WifiPpdu::WifiPpdu(const WifiConstPsduMap& psdus,
m_txPowerLevel(txVector.GetTxPowerLevel()),
m_txAntennas(txVector.GetNTx())
{
NS_LOG_FUNCTION(this << psdus << txVector << txCenterFreq << uid);
NS_LOG_FUNCTION(this << psdus << txVector << channel << uid);
m_psdus = psdus;
}

View File

@@ -40,6 +40,7 @@ namespace ns3
class Packet;
class WifiPsdu;
class WifiPhyOperatingChannel;
/**
* Map of const PSDUs indexed by STA-ID
@@ -60,24 +61,24 @@ class WifiPpdu : public SimpleRefCount<WifiPpdu>
*
* \param psdu the PHY payload (PSDU)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param uid the unique ID of this PPDU
*/
WifiPpdu(Ptr<const WifiPsdu> psdu,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
uint64_t uid = UINT64_MAX);
/**
* Create a PPDU storing a map of PSDUs.
*
* \param psdus the PHY payloads (PSDUs)
* \param txVector the TXVECTOR that was used for this PPDU
* \param txCenterFreq the center frequency (MHz) that was used for this PPDU
* \param channel the operating channel of the PHY used to transmit this PPDU
* \param uid the unique ID of this PPDU
*/
WifiPpdu(const WifiConstPsduMap& psdus,
const WifiTxVector& txVector,
uint16_t txCenterFreq,
const WifiPhyOperatingChannel& channel,
uint64_t uid);
/**
* Destructor for WifiPpdu.
@@ -206,6 +207,7 @@ class WifiPpdu : public SimpleRefCount<WifiPpdu>
mutable std::optional<WifiTxVector>
m_txVector; //!< the TXVECTOR at TX PHY or the reconstructed TXVECTOR at RX PHY (or
//!< std::nullopt if TXVECTOR has not been reconstructed yet)
const WifiPhyOperatingChannel& m_operatingChannel; //!< the operating channel of the PHY
#ifdef NS3_BUILD_PROFILE_DEBUG
Ptr<Packet> m_phyHeaders; //!< the PHY headers contained in this PPDU

View File

@@ -38,7 +38,6 @@ using namespace ns3;
NS_LOG_COMPONENT_DEFINE("SpectrumWifiPhyBasicTest");
static const uint8_t CHANNEL_NUMBER = 36;
static const uint32_t FREQUENCY = 5180; // MHz
static const uint16_t CHANNEL_WIDTH = 20; // MHz
static const uint16_t GUARD_WIDTH =
CHANNEL_WIDTH; // MHz (expanded to channel width to model spectrum mask)
@@ -75,9 +74,11 @@ class SpectrumWifiPhyBasicTest : public TestCase
/**
* Make signal function
* \param txPowerWatts the transmit power in watts
* \param channel the operating channel of the PHY used for the transmission
* \returns Ptr<SpectrumSignalParameters>
*/
Ptr<SpectrumSignalParameters> MakeSignal(double txPowerWatts);
Ptr<SpectrumSignalParameters> MakeSignal(double txPowerWatts,
const WifiPhyOperatingChannel& channel);
/**
* Send signal function
* \param txPowerWatts the transmit power in watts
@@ -121,10 +122,17 @@ SpectrumWifiPhyBasicTest::SpectrumWifiPhyBasicTest(std::string name)
// Make a Wi-Fi signal to inject directly to the StartRx() method
Ptr<SpectrumSignalParameters>
SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts)
SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts, const WifiPhyOperatingChannel& channel)
{
WifiTxVector txVector =
WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false);
WifiTxVector txVector = WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(),
0,
WIFI_PREAMBLE_LONG,
800,
1,
1,
0,
CHANNEL_WIDTH,
false);
Ptr<Packet> pkt = Create<Packet>(1000);
WifiMacHeader hdr;
@@ -135,13 +143,13 @@ SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts)
Ptr<WifiPsdu> psdu = Create<WifiPsdu>(pkt, hdr);
Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
Ptr<WifiPpdu> ppdu = Create<OfdmPpdu>(psdu, txVector, FREQUENCY, WIFI_PHY_BAND_5GHZ, m_uid++);
Ptr<WifiPpdu> ppdu = Create<OfdmPpdu>(psdu, txVector, channel, m_uid++);
Ptr<SpectrumValue> txPowerSpectrum =
WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(FREQUENCY,
CHANNEL_WIDTH,
txPowerWatts,
GUARD_WIDTH);
Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(
channel.GetPrimaryChannelCenterFrequency(CHANNEL_WIDTH),
CHANNEL_WIDTH,
txPowerWatts,
GUARD_WIDTH);
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters>();
txParams->psd = txPowerSpectrum;
txParams->txPhy = nullptr;
@@ -156,7 +164,7 @@ SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts)
void
SpectrumWifiPhyBasicTest::SendSignal(double txPowerWatts)
{
m_phy->StartRx(MakeSignal(txPowerWatts));
m_phy->StartRx(MakeSignal(txPowerWatts, m_phy->GetOperatingChannel()));
}
void

View File

@@ -94,27 +94,31 @@ class WifiPhyCcaThresholdsTest : public TestCase
Ptr<WifiPsdu> CreateDummyPsdu();
/**
* Create a non-HT PPDU
* \param channel the operating channel of the PHY used for the transmission
* \return a non-HT PPDU
*/
Ptr<OfdmPpdu> CreateDummyNonHtPpdu();
Ptr<OfdmPpdu> CreateDummyNonHtPpdu(const WifiPhyOperatingChannel& channel);
/**
* Create a HT PPDU
* \param bandwidth the bandwidth used for the transmission the PPDU in MHz
* \param channel the operating channel of the PHY used for the transmission
* \return a HT PPDU
*/
Ptr<HtPpdu> CreateDummyHtPpdu(uint16_t bandwidth);
Ptr<HtPpdu> CreateDummyHtPpdu(uint16_t bandwidth, const WifiPhyOperatingChannel& channel);
/**
* Create a VHT PPDU
* \param bandwidth the bandwidth used for the transmission the PPDU in MHz
* \param channel the operating channel of the PHY used for the transmission
* \return a VHT PPDU
*/
Ptr<VhtPpdu> CreateDummyVhtPpdu(uint16_t bandwidth);
Ptr<VhtPpdu> CreateDummyVhtPpdu(uint16_t bandwidth, const WifiPhyOperatingChannel& channel);
/**
* Create a HE PPDU
* \param bandwidth the bandwidth used for the transmission the PPDU in MHz
* \param channel the operating channel of the PHY used for the transmission
* \return a HE PPDU
*/
Ptr<HePpdu> CreateDummyHePpdu(uint16_t bandwidth);
Ptr<HePpdu> CreateDummyHePpdu(uint16_t bandwidth, const WifiPhyOperatingChannel& channel);
/**
* Function to verify the CCA threshold that is being reported by a given PHY entity upon
@@ -167,54 +171,42 @@ WifiPhyCcaThresholdsTest::CreateDummyPsdu()
}
Ptr<OfdmPpdu>
WifiPhyCcaThresholdsTest::CreateDummyNonHtPpdu()
WifiPhyCcaThresholdsTest::CreateDummyNonHtPpdu(const WifiPhyOperatingChannel& channel)
{
WifiTxVector txVector =
WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false);
Ptr<WifiPsdu> psdu = CreateDummyPsdu();
return Create<OfdmPpdu>(psdu, txVector, P20_CENTER_FREQUENCY, WIFI_PHY_BAND_5GHZ, 0);
return Create<OfdmPpdu>(psdu, txVector, channel, 0);
}
Ptr<HtPpdu>
WifiPhyCcaThresholdsTest::CreateDummyHtPpdu(uint16_t bandwidth)
WifiPhyCcaThresholdsTest::CreateDummyHtPpdu(uint16_t bandwidth,
const WifiPhyOperatingChannel& channel)
{
WifiTxVector txVector =
WifiTxVector(HtPhy::GetHtMcs0(), 0, WIFI_PREAMBLE_HT_MF, 800, 1, 1, 0, bandwidth, false);
Ptr<WifiPsdu> psdu = CreateDummyPsdu();
return Create<HtPpdu>(psdu,
txVector,
P20_CENTER_FREQUENCY,
MicroSeconds(100),
WIFI_PHY_BAND_5GHZ,
0);
return Create<HtPpdu>(psdu, txVector, channel, MicroSeconds(100), 0);
}
Ptr<VhtPpdu>
WifiPhyCcaThresholdsTest::CreateDummyVhtPpdu(uint16_t bandwidth)
WifiPhyCcaThresholdsTest::CreateDummyVhtPpdu(uint16_t bandwidth,
const WifiPhyOperatingChannel& channel)
{
WifiTxVector txVector =
WifiTxVector(VhtPhy::GetVhtMcs0(), 0, WIFI_PREAMBLE_VHT_SU, 800, 1, 1, 0, bandwidth, false);
Ptr<WifiPsdu> psdu = CreateDummyPsdu();
return Create<VhtPpdu>(psdu,
txVector,
P20_CENTER_FREQUENCY,
MicroSeconds(100),
WIFI_PHY_BAND_5GHZ,
0);
return Create<VhtPpdu>(psdu, txVector, channel, MicroSeconds(100), 0);
}
Ptr<HePpdu>
WifiPhyCcaThresholdsTest::CreateDummyHePpdu(uint16_t bandwidth)
WifiPhyCcaThresholdsTest::CreateDummyHePpdu(uint16_t bandwidth,
const WifiPhyOperatingChannel& channel)
{
WifiTxVector txVector =
WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, bandwidth, false);
Ptr<WifiPsdu> psdu = CreateDummyPsdu();
return Create<HePpdu>(psdu,
txVector,
P20_CENTER_FREQUENCY,
MicroSeconds(100),
WIFI_PHY_BAND_5GHZ,
0);
return Create<HePpdu>(psdu, txVector, channel, MicroSeconds(100), 0);
}
void
@@ -252,13 +244,9 @@ WifiPhyCcaThresholdsTest::DoSetup()
m_phy->SetDevice(m_device);
m_device->SetPhy(m_phy);
auto channelNum = std::get<0>(*WifiPhyOperatingChannel::FindFirst(0,
P20_CENTER_FREQUENCY,
20,
WIFI_STANDARD_80211ax,
WIFI_PHY_BAND_5GHZ));
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{channelNum, 20, WIFI_PHY_BAND_5GHZ, 0});
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{channelNum, 20, WIFI_PHY_BAND_5GHZ, 0});
auto channelNum = std::get<0>(
*WifiPhyOperatingChannel::FindFirst(0, 0, 160, WIFI_STANDARD_80211ax, WIFI_PHY_BAND_5GHZ));
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{channelNum, 160, WIFI_PHY_BAND_5GHZ, 0});
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
m_obssPdAlgorithm = CreateObject<ConstantObssPdAlgorithm>();
@@ -292,7 +280,7 @@ WifiPhyCcaThresholdsTest::RunOne()
// OFDM PHY: 20 MHz non-HT PPDU in primary channel (20 MHz) if power above CCA sensitivity
// threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_OFDM),
CreateDummyNonHtPpdu(),
CreateDummyNonHtPpdu(m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
@@ -315,14 +303,14 @@ WifiPhyCcaThresholdsTest::RunOne()
// HT PHY: 20 MHz HT PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity
// threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HT),
CreateDummyHtPpdu(20),
CreateDummyHtPpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
// HT PHY: 40 MHz HT PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity
// threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HT),
CreateDummyHtPpdu(40),
CreateDummyHtPpdu(40, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
@@ -357,28 +345,28 @@ WifiPhyCcaThresholdsTest::RunOne()
// VHT PHY: 20 MHz VHT PPDU in primary channel (20 MHz) if power in primary above CCA
// sensitivity threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(20),
CreateDummyVhtPpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
// VHT PHY: 40 MHz VHT PPDU in primary channel (20 MHz) if power in primary above CCA
// sensitivity threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(40),
CreateDummyVhtPpdu(40, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
// VHT PHY: 80 MHz VHT PPDU in primary channel (20 MHz) if power in primary above CCA
// sensitivity threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(80),
CreateDummyVhtPpdu(80, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
// VHT PHY: 160 MHz VHT PPDU in primary channel (20 MHz) if power in primary above CCA
// sensitivity threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(160),
CreateDummyVhtPpdu(160, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
@@ -387,42 +375,42 @@ WifiPhyCcaThresholdsTest::RunOne()
// VHT PHY: 20 MHz VHT PPDU in secondary channel (20 MHz) if power above the CCA sensitivity
// threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(20),
CreateDummyVhtPpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY,
std::get<0>(m_secondaryCcaSensitivityThresholds));
// VHT PHY: 20 MHz VHT PPDU in secondary40 channel (40 MHz) if power above the CCA sensitivity
// threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(20),
CreateDummyVhtPpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY40,
std::get<0>(m_secondaryCcaSensitivityThresholds));
// VHT PHY: 40 MHz VHT PPDU in secondary40 channel (40 MHz) if power above the CCA sensitivity
// threshold corresponding to a 40 MHz PPDU that does not occupy the primary 20 MHz
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(40),
CreateDummyVhtPpdu(40, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY40,
std::get<1>(m_secondaryCcaSensitivityThresholds));
// VHT PHY: 20 MHz VHT PPDU in secondary80 channel (80 MHz) if power above the CCA sensitivity
// threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(20),
CreateDummyVhtPpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY80,
std::get<0>(m_secondaryCcaSensitivityThresholds));
// VHT PHY: 40 MHz VHT PPDU in secondary80 channel (80 MHz) if power above the CCA sensitivity
// threshold corresponding to a 40 MHz PPDU that does not occupy the primary 20 MHz
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(40),
CreateDummyVhtPpdu(40, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY80,
std::get<1>(m_secondaryCcaSensitivityThresholds));
// VHT PHY: 80 MHz VHT PPDU in secondary80 channel (80 MHz) if power above the CCA sensitivity
// threshold corresponding to a 80 MHz PPDU that does not occupy the primary 20 MHz
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_VHT),
CreateDummyVhtPpdu(80),
CreateDummyVhtPpdu(80, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY80,
std::get<2>(m_secondaryCcaSensitivityThresholds));
@@ -457,28 +445,28 @@ WifiPhyCcaThresholdsTest::RunOne()
// HE PHY: 20 MHz HE PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity
// threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(20),
CreateDummyHePpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
// HE PHY: 40 MHz HE PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity
// threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(40),
CreateDummyHePpdu(40, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
// HE PHY: 80 MHz HE PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity
// threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(80),
CreateDummyHePpdu(80, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
// HE PHY: 160 MHz HE PPDU in primary channel (20 MHz) if power in primary above CCA sensitivity
// threshold
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(160),
CreateDummyHePpdu(160, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_PRIMARY,
m_CcaSensitivityDbm);
@@ -488,7 +476,7 @@ WifiPhyCcaThresholdsTest::RunOne()
// sensitivity threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz
// and the OBSS-PD level
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(20),
CreateDummyHePpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY,
std::max(m_obssPdLevel, std::get<0>(m_secondaryCcaSensitivityThresholds)));
@@ -496,7 +484,7 @@ WifiPhyCcaThresholdsTest::RunOne()
// sensitivity threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz
// and the OBSS-PD level
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(20),
CreateDummyHePpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY40,
std::max(m_obssPdLevel, std::get<0>(m_secondaryCcaSensitivityThresholds)));
@@ -505,7 +493,7 @@ WifiPhyCcaThresholdsTest::RunOne()
// and the OBSS-PD level plus 3 dB
VerifyCcaThreshold(
m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(40),
CreateDummyHePpdu(40, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY40,
std::max(m_obssPdLevel + 3.0, std::get<1>(m_secondaryCcaSensitivityThresholds)));
@@ -513,7 +501,7 @@ WifiPhyCcaThresholdsTest::RunOne()
// sensitivity threshold corresponding to a 20 MHz PPDU that does not occupy the primary 20 MHz
// and the OBSS-PD level
VerifyCcaThreshold(m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(20),
CreateDummyHePpdu(20, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY80,
std::max(m_obssPdLevel, std::get<0>(m_secondaryCcaSensitivityThresholds)));
@@ -522,7 +510,7 @@ WifiPhyCcaThresholdsTest::RunOne()
// and the OBSS-PD level plus 3 dB
VerifyCcaThreshold(
m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(40),
CreateDummyHePpdu(40, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY80,
std::max(m_obssPdLevel + 3.0, std::get<1>(m_secondaryCcaSensitivityThresholds)));
@@ -531,7 +519,7 @@ WifiPhyCcaThresholdsTest::RunOne()
// and the OBSS-PD level plus 6 dB
VerifyCcaThreshold(
m_phy->GetPhyEntity(WIFI_MOD_CLASS_HE),
CreateDummyHePpdu(80),
CreateDummyHePpdu(80, m_phy->GetOperatingChannel()),
WIFI_CHANLIST_SECONDARY80,
std::max(m_obssPdLevel + 6.0, std::get<2>(m_secondaryCcaSensitivityThresholds)));
}

View File

@@ -2433,9 +2433,8 @@ TestMultipleHeTbPreambles::RxHeTbPpdu(uint64_t uid,
m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand(), staId);
Ptr<HePpdu> ppdu = Create<HePpdu>(psdus,
txVector,
DEFAULT_FREQUENCY,
m_phy->GetOperatingChannel(),
ppduDuration,
WIFI_PHY_BAND_5GHZ,
uid,
HePpdu::PSD_NON_HE_PORTION);

View File

@@ -149,7 +149,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket(double rxPowerDbm)
Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
Ptr<WifiPpdu> ppdu =
Create<HePpdu>(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++);
Create<HePpdu>(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++);
Ptr<SpectrumValue> txPowerSpectrum =
WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY,
@@ -823,7 +823,7 @@ TestThresholdPreambleDetectionWithFrameCapture::SendPacket(double rxPowerDbm)
Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
Ptr<WifiPpdu> ppdu =
Create<HePpdu>(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++);
Create<HePpdu>(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++);
Ptr<SpectrumValue> txPowerSpectrum =
WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY,
@@ -1871,7 +1871,7 @@ TestSimpleFrameCaptureModel::SendPacket(double rxPowerDbm, uint32_t packetSize)
Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
Ptr<WifiPpdu> ppdu =
Create<HePpdu>(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++);
Create<HePpdu>(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++);
Ptr<SpectrumValue> txPowerSpectrum =
WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY,
@@ -2136,7 +2136,7 @@ TestPhyHeadersReception::SendPacket(double rxPowerDbm)
Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
Ptr<WifiPpdu> ppdu =
Create<HePpdu>(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++);
Create<HePpdu>(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++);
Ptr<SpectrumValue> txPowerSpectrum =
WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY,
@@ -2860,7 +2860,7 @@ TestAmpduReception::SendAmpduWithThreeMpdus(double rxPowerDbm, uint32_t referenc
Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
Ptr<WifiPpdu> ppdu =
Create<HePpdu>(psdu, txVector, FREQUENCY, txDuration, WIFI_PHY_BAND_5GHZ, m_uid++);
Create<HePpdu>(psdu, txVector, m_phy->GetOperatingChannel(), txDuration, m_uid++);
Ptr<SpectrumValue> txPowerSpectrum =
WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY,
@@ -4317,11 +4317,10 @@ class TestUnsupportedBandwidthReception : public TestCase
/**
* Function to create a PPDU
*
* \param band the PHY band to use
* \param centerFreqMhz the center frequency used for the transmission of the PPDU (in MHz)
* \param bandwidthMhz the bandwidth used for the transmission of the PPDU (in MHz)
*/
void SendPpdu(WifiPhyBand band, uint16_t centerFreqMhz, uint16_t bandwidthMhz);
void SendPpdu(uint16_t centerFreqMhz, uint16_t bandwidthMhz);
/**
* Function called upon a PSDU received successfully
@@ -4374,7 +4373,8 @@ class TestUnsupportedBandwidthReception : public TestCase
std::optional<Time> m_lastRxFailed; ///< time of last RX failure, if any
std::optional<Time> m_lastRxDropped; ///< time of last RX drop, if any
Ptr<SpectrumWifiPhy> m_phy; ///< PHY
Ptr<SpectrumWifiPhy> m_rxPhy; ///< RX PHY
Ptr<SpectrumWifiPhy> m_txPhy; ///< TX PHY
};
TestUnsupportedBandwidthReception::TestUnsupportedBandwidthReception()
@@ -4390,9 +4390,7 @@ TestUnsupportedBandwidthReception::TestUnsupportedBandwidthReception()
}
void
TestUnsupportedBandwidthReception::SendPpdu(WifiPhyBand band,
uint16_t centerFreqMhz,
uint16_t bandwidthMhz)
TestUnsupportedBandwidthReception::SendPpdu(uint16_t centerFreqMhz, uint16_t bandwidthMhz)
{
auto txVector =
WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, bandwidthMhz, false);
@@ -4404,9 +4402,10 @@ TestUnsupportedBandwidthReception::SendPpdu(WifiPhyBand band,
hdr.SetQosTid(0);
Ptr<WifiPsdu> psdu = Create<WifiPsdu>(pkt, hdr);
Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
Time txDuration =
m_rxPhy->CalculateTxDuration(psdu->GetSize(), txVector, m_rxPhy->GetPhyBand());
auto ppdu = Create<HePpdu>(psdu, txVector, centerFreqMhz, txDuration, WIFI_PHY_BAND_5GHZ, 0);
auto ppdu = Create<HePpdu>(psdu, txVector, m_txPhy->GetOperatingChannel(), txDuration, 0);
auto txPowerSpectrum =
WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(centerFreqMhz,
@@ -4421,7 +4420,7 @@ TestUnsupportedBandwidthReception::SendPpdu(WifiPhyBand band,
txParams->ppdu = ppdu;
txParams->txWidth = bandwidthMhz;
m_phy->StartRx(txParams);
m_rxPhy->StartRx(txParams);
}
void
@@ -4503,26 +4502,37 @@ TestUnsupportedBandwidthReception::CheckRx(uint32_t expectedCountRxSuccess,
void
TestUnsupportedBandwidthReception::DoSetup()
{
m_phy = CreateObject<SpectrumWifiPhy>();
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
auto interferenceHelper = CreateObject<InterferenceHelper>();
m_phy->SetInterferenceHelper(interferenceHelper);
auto error = CreateObject<NistErrorRateModel>();
m_phy->SetErrorRateModel(error);
m_rxPhy = CreateObject<SpectrumWifiPhy>();
m_rxPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
auto rxInterferenceHelper = CreateObject<InterferenceHelper>();
m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
auto rxErrorRateModel = CreateObject<NistErrorRateModel>();
m_rxPhy->SetErrorRateModel(rxErrorRateModel);
m_phy->SetReceiveOkCallback(MakeCallback(&TestUnsupportedBandwidthReception::RxSuccess, this));
m_phy->SetReceiveErrorCallback(
m_rxPhy->SetReceiveOkCallback(
MakeCallback(&TestUnsupportedBandwidthReception::RxSuccess, this));
m_rxPhy->SetReceiveErrorCallback(
MakeCallback(&TestUnsupportedBandwidthReception::RxFailure, this));
m_phy->TraceConnectWithoutContext(
m_rxPhy->TraceConnectWithoutContext(
"PhyRxDrop",
MakeCallback(&TestUnsupportedBandwidthReception::RxDropped, this));
m_txPhy = CreateObject<SpectrumWifiPhy>();
m_txPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
auto txInterferenceHelper = CreateObject<InterferenceHelper>();
m_txPhy->SetInterferenceHelper(txInterferenceHelper);
auto txErrorRateModel = CreateObject<NistErrorRateModel>();
m_txPhy->SetErrorRateModel(txErrorRateModel);
}
void
TestUnsupportedBandwidthReception::DoTeardown()
{
m_phy->Dispose();
m_phy = nullptr;
m_rxPhy->Dispose();
m_rxPhy = nullptr;
m_txPhy->Dispose();
m_txPhy = nullptr;
}
void
@@ -4532,20 +4542,16 @@ TestUnsupportedBandwidthReception::DoRun()
RngSeedManager::SetRun(1);
int64_t streamNumber = 0;
m_phy->AssignStreams(streamNumber);
m_rxPhy->AssignStreams(streamNumber);
// Case 1: the PHY is operating on channel 36 (20 MHz) and receives a 40 MHz PPDU (channel 38).
// The PPDU should be dropped once HE-SIG-A is successfully received, since it contains
// indication about the BW used for the transmission and the PHY shall detect it is larger than
// its operating BW.
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{36, 20, WIFI_PHY_BAND_5GHZ, 0});
m_txPhy->SetOperatingChannel(WifiPhy::ChannelTuple{38, 40, WIFI_PHY_BAND_5GHZ, 0});
m_rxPhy->SetOperatingChannel(WifiPhy::ChannelTuple{36, 20, WIFI_PHY_BAND_5GHZ, 0});
Simulator::Schedule(Seconds(1.0),
&TestUnsupportedBandwidthReception::SendPpdu,
this,
WIFI_PHY_BAND_5GHZ,
5190,
40);
Simulator::Schedule(Seconds(1.0), &TestUnsupportedBandwidthReception::SendPpdu, this, 5190, 40);
auto heSigAExpectedRxTime = Seconds(1.0) + MicroSeconds(32);
Simulator::Schedule(Seconds(1.5),
@@ -4585,11 +4591,10 @@ class TestPrimary20CoveredByPpdu : public TestCase
/**
* Function to create a PPDU
*
* \param band the PHY band to use
* \param ppduCenterFreqMhz the center frequency used for the transmission of the PPDU (in MHz)
* \return the created PPDU
*/
Ptr<HePpdu> CreatePpdu(WifiPhyBand band, uint16_t ppduCenterFreqMhz);
Ptr<HePpdu> CreatePpdu(uint16_t ppduCenterFreqMhz);
/**
* Run one function
@@ -4610,7 +4615,8 @@ class TestPrimary20CoveredByPpdu : public TestCase
bool expectedP20Overlap,
bool expectedP20Covered);
Ptr<SpectrumWifiPhy> m_phy; ///< PHY
Ptr<SpectrumWifiPhy> m_rxPhy; ///< RX PHY
Ptr<SpectrumWifiPhy> m_txPhy; ///< TX PHY
};
TestPrimary20CoveredByPpdu::TestPrimary20CoveredByPpdu()
@@ -4620,11 +4626,15 @@ TestPrimary20CoveredByPpdu::TestPrimary20CoveredByPpdu()
}
Ptr<HePpdu>
TestPrimary20CoveredByPpdu::CreatePpdu(WifiPhyBand band, uint16_t ppduCenterFreqMhz)
TestPrimary20CoveredByPpdu::CreatePpdu(uint16_t ppduCenterFreqMhz)
{
[[maybe_unused]] auto [channelNumber, centerFreq, channelWidth, type, phyBand] =
(*WifiPhyOperatingChannel::FindFirst(0, ppduCenterFreqMhz, 0, WIFI_STANDARD_80211ax, band));
(*WifiPhyOperatingChannel::FindFirst(0,
ppduCenterFreqMhz,
0,
WIFI_STANDARD_80211ax,
m_rxPhy->GetPhyBand()));
m_txPhy->SetOperatingChannel(WifiPhy::ChannelTuple{channelNumber, channelWidth, phyBand, 0});
auto txVector =
WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, channelWidth, false);
@@ -4632,27 +4642,36 @@ TestPrimary20CoveredByPpdu::CreatePpdu(WifiPhyBand band, uint16_t ppduCenterFreq
WifiMacHeader hdr(WIFI_MAC_QOSDATA);
auto psdu = Create<WifiPsdu>(pkt, hdr);
auto txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, band);
auto txDuration = m_txPhy->CalculateTxDuration(psdu->GetSize(), txVector, phyBand);
return Create<HePpdu>(psdu, txVector, ppduCenterFreqMhz, txDuration, band, 0);
return Create<HePpdu>(psdu, txVector, m_txPhy->GetOperatingChannel(), txDuration, 0);
}
void
TestPrimary20CoveredByPpdu::DoSetup()
{
m_phy = CreateObject<SpectrumWifiPhy>();
m_phy->ConfigureStandard(WIFI_STANDARD_80211ax);
auto interferenceHelper = CreateObject<InterferenceHelper>();
m_phy->SetInterferenceHelper(interferenceHelper);
auto error = CreateObject<NistErrorRateModel>();
m_phy->SetErrorRateModel(error);
m_rxPhy = CreateObject<SpectrumWifiPhy>();
m_rxPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
auto rxInterferenceHelper = CreateObject<InterferenceHelper>();
m_rxPhy->SetInterferenceHelper(rxInterferenceHelper);
auto rxErrorRateModel = CreateObject<NistErrorRateModel>();
m_rxPhy->SetErrorRateModel(rxErrorRateModel);
m_txPhy = CreateObject<SpectrumWifiPhy>();
m_txPhy->ConfigureStandard(WIFI_STANDARD_80211ax);
auto txInterferenceHelper = CreateObject<InterferenceHelper>();
m_txPhy->SetInterferenceHelper(txInterferenceHelper);
auto txErrorRateModel = CreateObject<NistErrorRateModel>();
m_txPhy->SetErrorRateModel(txErrorRateModel);
}
void
TestPrimary20CoveredByPpdu::DoTeardown()
{
m_phy->Dispose();
m_phy = nullptr;
m_rxPhy->Dispose();
m_rxPhy = nullptr;
m_txPhy->Dispose();
m_txPhy = nullptr;
}
void
@@ -4666,12 +4685,13 @@ TestPrimary20CoveredByPpdu::RunOne(WifiPhyBand band,
[[maybe_unused]] const auto [channelNumber, centerFreq, channelWidth, type, phyBand] =
(*WifiPhyOperatingChannel::FindFirst(0, phyCenterFreqMhz, 0, WIFI_STANDARD_80211ax, band));
m_phy->SetOperatingChannel(WifiPhy::ChannelTuple{channelNumber, channelWidth, band, p20Index});
auto p20CenterFreq = m_phy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(20);
m_rxPhy->SetOperatingChannel(
WifiPhy::ChannelTuple{channelNumber, channelWidth, band, p20Index});
auto p20CenterFreq = m_rxPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(20);
auto p20MinFreq = p20CenterFreq - 10;
auto p20MaxFreq = p20CenterFreq + 10;
auto ppdu = CreatePpdu(band, ppduCenterFreqMhz);
auto ppdu = CreatePpdu(ppduCenterFreqMhz);
auto p20Overlap = ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq);
NS_TEST_ASSERT_MSG_EQ(p20Overlap,
@@ -4680,7 +4700,7 @@ TestPrimary20CoveredByPpdu::RunOne(WifiPhyBand band,
<< " to overlap with the P20");
auto p20Covered =
m_phy->GetPhyEntity(WIFI_STANDARD_80211ax)
m_rxPhy->GetPhyEntity(WIFI_STANDARD_80211ax)
->CanStartRx(
ppdu,
ppdu->GetTxVector()
@@ -4704,7 +4724,7 @@ TestPrimary20CoveredByPpdu::DoRun()
/*
* Receiver PHY Operating Channel: 2.4 GHz Channel 4 (2417 MHz 2437 MHz)
* Transmitted 40 MHz PPDU: 2.4 GHz Channel 6 (2427 MHz 2447 MHz)
* Transmitted 20 MHz PPDU: 2.4 GHz Channel 6 (2427 MHz 2447 MHz)
* Overlap with primary 20 MHz: yes
* Primary 20 MHz fully covered: no
*/

View File

@@ -63,9 +63,11 @@ class WifiPhyThresholdsTest : public TestCase
/**
* Make wifi signal function
* \param txPowerWatts the transmit power in watts
* \param channel the operating channel of the PHY used for the transmission
* \returns Ptr<SpectrumSignalParameters>
*/
virtual Ptr<SpectrumSignalParameters> MakeWifiSignal(double txPowerWatts);
virtual Ptr<SpectrumSignalParameters> MakeWifiSignal(double txPowerWatts,
const WifiPhyOperatingChannel& channel);
/**
* Make foreign signal function
* \param txPowerWatts the transmit power in watts
@@ -139,10 +141,17 @@ WifiPhyThresholdsTest::~WifiPhyThresholdsTest()
}
Ptr<SpectrumSignalParameters>
WifiPhyThresholdsTest::MakeWifiSignal(double txPowerWatts)
WifiPhyThresholdsTest::MakeWifiSignal(double txPowerWatts, const WifiPhyOperatingChannel& channel)
{
WifiTxVector txVector =
WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false);
WifiTxVector txVector = WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(),
0,
WIFI_PREAMBLE_LONG,
800,
1,
1,
0,
CHANNEL_WIDTH,
false);
Ptr<Packet> pkt = Create<Packet>(1000);
WifiMacHeader hdr;
@@ -153,13 +162,14 @@ WifiPhyThresholdsTest::MakeWifiSignal(double txPowerWatts)
Ptr<WifiPsdu> psdu = Create<WifiPsdu>(pkt, hdr);
Time txDuration = m_phy->CalculateTxDuration(psdu->GetSize(), txVector, m_phy->GetPhyBand());
Ptr<WifiPpdu> ppdu = Create<OfdmPpdu>(psdu, txVector, FREQUENCY, WIFI_PHY_BAND_5GHZ, 0);
Ptr<WifiPpdu> ppdu = Create<OfdmPpdu>(psdu, txVector, channel, 0);
Ptr<SpectrumValue> txPowerSpectrum =
WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(FREQUENCY,
CHANNEL_WIDTH,
txPowerWatts,
CHANNEL_WIDTH);
WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity(
channel.GetPrimaryChannelCenterFrequency(CHANNEL_WIDTH),
CHANNEL_WIDTH,
txPowerWatts,
CHANNEL_WIDTH);
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters>();
txParams->psd = txPowerSpectrum;
txParams->txPhy = nullptr;
@@ -189,7 +199,7 @@ WifiPhyThresholdsTest::SendSignal(double txPowerWatts, bool wifiSignal)
{
if (wifiSignal)
{
m_phy->StartRx(MakeWifiSignal(txPowerWatts));
m_phy->StartRx(MakeWifiSignal(txPowerWatts, m_phy->GetOperatingChannel()));
}
else
{