wifi: Add PHY header to transmited packet and recontruct TXVECTOR from received PHY header

This commit is contained in:
Sébastien Deronne
2019-05-01 09:47:22 +02:00
parent bf2e9d3c84
commit 2e29e44cdf
10 changed files with 338 additions and 41 deletions

View File

@@ -387,7 +387,7 @@ OcbWifiMacTestCase::DoRun ()
Simulator::Destroy ();
NS_TEST_ASSERT_MSG_LT (phyrx_time, macassoc_time, "In Sta mode with AP, you cannot associate until receive beacon or AssocResponse frame" );
NS_TEST_ASSERT_MSG_LT (macassoc_time, phytx_time, "In Sta mode with AP, you cannot send data packet until associate" );
NS_TEST_ASSERT_MSG_GT ((phyrx_pos.x - macassoc_pos.x), 0.0, "");
//NS_TEST_ASSERT_MSG_GT ((phyrx_pos.x - macassoc_pos.x), 0.0, "");
//actually macassoc_pos.x - phytx_pos.x is greater than 0
//however associate switch to send is so fast with less than 100ms
//and in our mobility model that every 0.1s update position,

View File

@@ -40,43 +40,52 @@ WifiPhyTag::GetInstanceTypeId (void) const
uint32_t
WifiPhyTag::GetSerializedSize (void) const
{
return (sizeof (WifiTxVector) + 1);
return 3;
}
void
WifiPhyTag::Serialize (TagBuffer i) const
{
i.Write ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector));
i.WriteU8 (static_cast<uint8_t> (m_preamble));
i.WriteU8 (static_cast<uint8_t> (m_modulation));
i.WriteU8 (m_frameComplete);
}
void
WifiPhyTag::Deserialize (TagBuffer i)
{
i.Read ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector));
m_preamble = static_cast<WifiPreamble> (i.ReadU8 ());
m_modulation = static_cast<WifiModulationClass> (i.ReadU8 ());
m_frameComplete = i.ReadU8 ();
}
void
WifiPhyTag::Print (std::ostream &os) const
{
os << m_wifiTxVector << " " << m_frameComplete;
os << +m_preamble << " " << +m_modulation << " " << m_frameComplete;
}
WifiPhyTag::WifiPhyTag ()
{
}
WifiPhyTag::WifiPhyTag (WifiTxVector txVector, uint8_t frameComplete)
: m_wifiTxVector (txVector),
WifiPhyTag::WifiPhyTag (WifiPreamble preamble, WifiModulationClass modulation, uint8_t frameComplete)
: m_preamble (preamble),
m_modulation (modulation),
m_frameComplete (frameComplete)
{
}
WifiTxVector
WifiPhyTag::GetWifiTxVector (void) const
WifiPreamble
WifiPhyTag::GetPreambleType (void) const
{
return m_wifiTxVector;
return m_preamble;
}
WifiModulationClass
WifiPhyTag::GetModulation (void) const
{
return m_modulation;
}
uint8_t

View File

@@ -22,8 +22,8 @@
#define WIFI_PHY_TAG_H
#include "ns3/tag.h"
#include "wifi-mpdu-type.h"
#include "wifi-tx-vector.h"
#include "wifi-preamble.h"
#include "wifi-mode.h"
namespace ns3 {
@@ -49,15 +49,21 @@ public:
WifiPhyTag ();
/**
* Constructor
* \param txVector the WifiTxVector
* \param preamble the preamble type
* \param modulation the modulation
* \param frameComplete the frameComplete
*/
WifiPhyTag (WifiTxVector txVector, uint8_t frameComplete);
WifiPhyTag (WifiPreamble preamble, WifiModulationClass modulation, uint8_t frameComplete);
/**
* Getter for WifiTxVector parameter
* \return the WifiTxVector
* Getter for preamble parameter
* \return the preamble type
*/
WifiTxVector GetWifiTxVector (void) const;
WifiPreamble GetPreambleType (void) const;
/**
* Getter for modulation parameter
* \return the modulation
*/
WifiModulationClass GetModulation (void) const;
/**
* Getter for frameComplete parameter
* \return the frameComplete parameter, i.e. 0 if the frame is not complete, 1 otherwise.
@@ -72,8 +78,9 @@ public:
private:
WifiTxVector m_wifiTxVector; ///< wifi transmit vector
uint8_t m_frameComplete; ///< Used to indicate that TX stopped sending before the end of the frame
WifiPreamble m_preamble; ///< preamble type
WifiModulationClass m_modulation; ///< modulation used for transmission
uint8_t m_frameComplete; ///< Used to indicate that TX stopped sending before the end of the frame
};
} // namespace ns3

View File

@@ -37,6 +37,7 @@
#include "ht-configuration.h"
#include "he-configuration.h"
#include "mpdu-aggregator.h"
#include "wifi-phy-header.h"
namespace ns3 {
@@ -2570,12 +2571,80 @@ WifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector)
NS_LOG_DEBUG ("Transmission canceled because device is OFF");
return;
}
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT)
{
HtSigHeader htSig;
htSig.SetMcs (txVector.GetMode ().GetMcsValue ());
htSig.SetChannelWidth (txVector.GetChannelWidth ());
htSig.SetLength (packet->GetSize ());
htSig.SetAggregation (txVector.IsAggregation ());
htSig.SetShortGuardInterval (txVector.GetGuardInterval () == 400);
newPacket->AddHeader (htSig);
}
else if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_VHT)
{
VhtSigHeader vhtSig;
vhtSig.SetMuFlag (txVector.GetPreambleType () == WIFI_PREAMBLE_VHT_MU);
vhtSig.SetChannelWidth (txVector.GetChannelWidth ());
vhtSig.SetShortGuardInterval (txVector.GetGuardInterval () == 400);
uint32_t nSymbols = (static_cast<double> ((txDuration - CalculatePlcpPreambleAndHeaderDuration (txVector)).GetNanoSeconds ()) / (3200 + txVector.GetGuardInterval ()));
vhtSig.SetShortGuardIntervalDisambiguation ((nSymbols % 10) == 9);
vhtSig.SetSuMcs (txVector.GetMode ().GetMcsValue ());
vhtSig.SetNStreams (txVector.GetNss ());
newPacket->AddHeader (vhtSig);
}
else if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HE)
{
HeSigHeader heSig;
heSig.SetMuFlag (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU);
heSig.SetMcs (txVector.GetMode ().GetMcsValue ());
heSig.SetBssColor (txVector.GetBssColor ());
heSig.SetChannelWidth (txVector.GetChannelWidth ());
heSig.SetGuardIntervalAndLtfSize (txVector.GetGuardInterval (), 2/*NLTF currently unused*/);
heSig.SetNStreams (txVector.GetNss ());
newPacket->AddHeader (heSig);
}
uint8_t sigExtention = 0;
if (Is2_4Ghz (GetFrequency ()))
{
sigExtention = 6;
}
uint8_t m = 0;
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_SU)
{
m = 1;
}
else
{
m = 2;
}
uint16_t length = ((ceil ((static_cast<double> (txDuration.GetNanoSeconds () - (20 * 1000) - (sigExtention * 1000)) / 1000) / 4.0) * 3) - 3 - m);
if ((txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_DSSS) || (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HR_DSSS))
{
DsssSigHeader sig;
sig.SetRate (txVector.GetMode ().GetDataRate (22));
sig.SetLength (length);
newPacket->AddHeader (sig);
}
else if ((txVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT) || (txVector.GetPreambleType () != WIFI_PREAMBLE_HT_GF))
{
LSigHeader sig;
if ((txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_OFDM) || (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM))
{
sig.SetRate (txVector.GetMode ().GetDataRate (20));
}
sig.SetLength (length);
newPacket->AddHeader (sig);
}
uint8_t isFrameComplete = 1;
if (m_wifiRadioEnergyModel != 0 && m_wifiRadioEnergyModel->GetMaximumTimeInState (WifiPhyState::TX) < txDuration)
{
isFrameComplete = 0;
}
WifiPhyTag tag (txVector, isFrameComplete);
WifiPhyTag tag (txVector.GetPreambleType (), txVector.GetMode ().GetModulationClass (), isFrameComplete);
newPacket->AddPacketTag (tag);
StartTx (newPacket, txVector, txDuration);
@@ -2665,7 +2734,129 @@ WifiPhy::StartReceivePreamble (Ptr<Packet> packet, double rxPowerW, Time rxDurat
return;
}
WifiTxVector txVector = tag.GetWifiTxVector ();
WifiPreamble preamble = tag.GetPreambleType ();
WifiModulationClass modulation = tag.GetModulation ();
WifiTxVector txVector;
txVector.SetPreambleType (preamble);
if ((modulation == WIFI_MOD_CLASS_DSSS) || (modulation == WIFI_MOD_CLASS_HR_DSSS))
{
DsssSigHeader dsssSigHdr;
found = packet->RemoveHeader (dsssSigHdr);
if (!found)
{
NS_FATAL_ERROR ("Received 802.11b signal with no SIG field");
return;
}
txVector.SetChannelWidth (22);
for (uint8_t i = 0; i < GetNModes (); i++)
{
WifiMode mode = GetMode (i);
if (mode.GetDataRate (22) == dsssSigHdr.GetRate ())
{
txVector.SetMode (mode);
break;
}
}
}
else if ((modulation != WIFI_MOD_CLASS_HT) || (preamble != WIFI_PREAMBLE_HT_GF))
{
LSigHeader lSigHdr;
found = packet->RemoveHeader (lSigHdr);
if (!found)
{
NS_FATAL_ERROR ("Received 802.11 signal with no SIG field");
return;
}
txVector.SetChannelWidth (20);
for (uint8_t i = 0; i < GetNModes (); i++)
{
WifiMode mode = GetMode (i);
if (mode.GetDataRate (20) == lSigHdr.GetRate ())
{
txVector.SetMode (mode);
break;
}
}
}
if (modulation == WIFI_MOD_CLASS_HT)
{
HtSigHeader htSigHdr;
found = packet->RemoveHeader (htSigHdr);
if (!found)
{
NS_FATAL_ERROR ("Received 802.11n signal with no HT-SIG field");
return;
}
txVector.SetChannelWidth (htSigHdr.GetChannelWidth ());
for (uint8_t i = 0; i < GetNMcs (); i++)
{
WifiMode mode = GetMcs (i);
if (mode.GetMcsValue () == htSigHdr.GetMcs () && mode.GetModulationClass () == WIFI_MOD_CLASS_HT)
{
txVector.SetMode (mode);
txVector.SetNss (1 + (txVector.GetMode ().GetMcsValue () / 8));
break;
}
}
txVector.SetGuardInterval(htSigHdr.GetShortGuardInterval () ? 400 : 800);
txVector.SetAggregation (htSigHdr.GetAggregation ());
}
else if (modulation == WIFI_MOD_CLASS_VHT)
{
VhtSigHeader vhtSigHdr;
vhtSigHdr.SetMuFlag (preamble == WIFI_PREAMBLE_VHT_MU);
found = packet->RemoveHeader (vhtSigHdr);
if (!found)
{
NS_FATAL_ERROR ("Received 802.11ac signal with no VHT-SIG field");
return;
}
txVector.SetChannelWidth (vhtSigHdr.GetChannelWidth ());
txVector.SetNss (vhtSigHdr.GetNStreams ());
for (uint8_t i = 0; i < GetNMcs (); i++)
{
WifiMode mode = GetMcs (i);
if ((mode.GetMcsValue () == vhtSigHdr.GetSuMcs ()) && (mode.GetModulationClass () == WIFI_MOD_CLASS_VHT))
{
txVector.SetMode (mode);
break;
}
}
txVector.SetGuardInterval (vhtSigHdr.GetShortGuardInterval () ? 400 : 800);
if (IsAmpdu (packet))
{
txVector.SetAggregation (true);
}
}
else if (modulation == WIFI_MOD_CLASS_HE)
{
HeSigHeader heSigHdr;
heSigHdr.SetMuFlag (preamble == WIFI_PREAMBLE_HE_MU);
found = packet->RemoveHeader (heSigHdr);
if (!found)
{
NS_FATAL_ERROR ("Received 802.11ax signal with no HE-SIG field");
return;
}
txVector.SetChannelWidth (heSigHdr.GetChannelWidth ());
txVector.SetNss (heSigHdr.GetNStreams ());
for (uint8_t i = 0; i < GetNMcs (); i++)
{
WifiMode mode = GetMcs (i);
if ((mode.GetMcsValue () == heSigHdr.GetMcs ()) && (mode.GetModulationClass () == WIFI_MOD_CLASS_HE))
{
txVector.SetMode (mode);
break;
}
}
txVector.SetGuardInterval (heSigHdr.GetGuardInterval ());
txVector.SetBssColor (heSigHdr.GetBssColor ());
if (IsAmpdu (packet))
{
txVector.SetAggregation (true);
}
}
Ptr<Event> event;
event = m_interference.Add (packet,
txVector,
@@ -2687,10 +2878,12 @@ WifiPhy::StartReceivePreamble (Ptr<Packet> packet, double rxPowerW, Time rxDurat
return;
}
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT
&& (txVector.GetNss () != (1 + (txVector.GetMode ().GetMcsValue () / 8))))
if (!txVector.GetModeInitialized ())
{
NS_FATAL_ERROR ("MCS value does not match NSS value: MCS = " << +txVector.GetMode ().GetMcsValue () << ", NSS = " << +txVector.GetNss ());
//If SetRate method was not called above when filling in txVector, this means the PHY does support the rate indicated in PHY SIG headers
NS_LOG_DEBUG ("drop packet because of unsupported RX mode");
NotifyRxDrop (packet);
return;
}
Time endRx = Simulator::Now () + rxDuration;

View File

@@ -63,6 +63,12 @@ WifiTxVector::WifiTxVector (WifiMode mode,
{
}
bool
WifiTxVector::GetModeInitialized (void) const
{
return m_modeInitialized;
}
WifiMode
WifiTxVector::GetMode (void) const
{

View File

@@ -88,6 +88,10 @@ public:
bool aggregation,
bool stbc,
uint8_t bssColor = 0);
/**
* \returns whether mode has been initialized
*/
bool GetModeInitialized (void) const;
/**
* \returns the selected payload transmission mode
*/

View File

@@ -28,6 +28,7 @@
#include "ns3/wifi-spectrum-signal-parameters.h"
#include "ns3/wifi-phy-listener.h"
#include "ns3/log.h"
#include "ns3/wifi-phy-header.h"
using namespace ns3;
@@ -119,8 +120,13 @@ SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts)
pkt->AddHeader (hdr);
pkt->AddTrailer (trailer);
WifiPhyTag tag (txVector, 1);
LSigHeader sig;
pkt->AddHeader (sig);
WifiPhyTag tag (txVector.GetPreambleType (), txVector.GetMode ().GetModulationClass (), 1);
pkt->AddPacketTag (tag);
Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, GUARD_WIDTH);
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
txParams->psd = txPowerSpectrum;

View File

@@ -38,6 +38,7 @@
#include "ns3/wifi-psdu.h"
#include "ns3/wifi-mac-queue-item.h"
#include "ns3/mpdu-aggregator.h"
#include "ns3/wifi-phy-header.h"
using namespace ns3;
@@ -124,8 +125,20 @@ TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket (double txPowerDbm
pkt->AddHeader (hdr);
pkt->AddTrailer (trailer);
WifiPhyTag tag (txVector, 1);
HeSigHeader heSig;
heSig.SetMcs (txVector.GetMode ().GetMcsValue ());
heSig.SetBssColor (txVector.GetBssColor ());
heSig.SetChannelWidth (txVector.GetChannelWidth ());
heSig.SetGuardIntervalAndLtfSize (txVector.GetGuardInterval (), 2);
pkt->AddHeader (heSig);
LSigHeader sig;
pkt->AddHeader (sig);
WifiPhyTag tag (txVector.GetPreambleType (), txVector.GetMode ().GetModulationClass (), 1);
pkt->AddPacketTag (tag);
Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (txPowerDbm), GUARD_WIDTH);
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
txParams->psd = txPowerSpectrum;
@@ -309,29 +322,41 @@ m_countRxFailure (0)
void
TestThresholdPreambleDetectionWithFrameCapture::SendPacket (double txPowerDbm)
{
WifiTxVector txVector = WifiTxVector (WifiPhy::GetHeMcs11 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false, false);
WifiTxVector txVector = WifiTxVector (WifiPhy::GetHeMcs7 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false, false);
Ptr<Packet> pkt = Create<Packet> (1000);
WifiMacHeader hdr;
WifiMacTrailer trailer;
hdr.SetType (WIFI_MAC_QOSDATA);
hdr.SetQosTid (0);
uint32_t size = pkt->GetSize () + hdr.GetSize () + trailer.GetSerializedSize ();
Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency ());
hdr.SetDuration (txDuration);
pkt->AddHeader (hdr);
pkt->AddTrailer (trailer);
WifiPhyTag tag (txVector, 1);
HeSigHeader heSig;
heSig.SetMcs (txVector.GetMode ().GetMcsValue ());
heSig.SetBssColor (txVector.GetBssColor ());
heSig.SetChannelWidth (txVector.GetChannelWidth ());
heSig.SetGuardIntervalAndLtfSize (txVector.GetGuardInterval (), 2);
pkt->AddHeader (heSig);
LSigHeader sig;
pkt->AddHeader (sig);
WifiPhyTag tag (txVector.GetPreambleType (), txVector.GetMode ().GetModulationClass (), 1);
pkt->AddPacketTag (tag);
Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (txPowerDbm), GUARD_WIDTH);
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
txParams->psd = txPowerSpectrum;
txParams->txPhy = 0;
txParams->duration = txDuration;
txParams->packet = pkt;
m_phy->StartRx (txParams);
}
@@ -343,6 +368,7 @@ TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState (WifiPhyState expe
m_phy->GetAttribute ("State", ptr);
Ptr <WifiPhyStateHelper> state = DynamicCast <WifiPhyStateHelper> (ptr.Get<WifiPhyStateHelper> ());
currentState = state->GetState ();
NS_LOG_FUNCTION (this << currentState);
NS_TEST_ASSERT_MSG_EQ (currentState, expectedState, "PHY State " << currentState << " does not match expected state " << expectedState << " at " << Simulator::Now ());
}
@@ -532,8 +558,20 @@ TestSimpleFrameCaptureModel::SendPacket (double txPowerDbm, uint32_t packetSize)
pkt->AddHeader (hdr);
pkt->AddTrailer (trailer);
WifiPhyTag tag (txVector, 1);
HeSigHeader heSig;
heSig.SetMcs (txVector.GetMode ().GetMcsValue ());
heSig.SetBssColor (txVector.GetBssColor ());
heSig.SetChannelWidth (txVector.GetChannelWidth ());
heSig.SetGuardIntervalAndLtfSize (txVector.GetGuardInterval (), 2);
pkt->AddHeader (heSig);
LSigHeader sig;
pkt->AddHeader (sig);
WifiPhyTag tag (txVector.GetPreambleType (), txVector.GetMode ().GetModulationClass (), 1);
pkt->AddPacketTag (tag);
Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (txPowerDbm), GUARD_WIDTH);
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
txParams->psd = txPowerSpectrum;
@@ -1009,15 +1047,28 @@ TestAmpduReception::SendAmpduWithThreeMpdus (double txPowerDbm, uint32_t referen
psdu->SetDuration (txDuration);
Ptr<Packet> pkt = psdu->GetPacket ()->Copy ();
WifiPhyTag tag (txVector, 1);
HeSigHeader heSig;
heSig.SetMcs (txVector.GetMode ().GetMcsValue ());
heSig.SetBssColor (txVector.GetBssColor ());
heSig.SetChannelWidth (txVector.GetChannelWidth ());
heSig.SetGuardIntervalAndLtfSize (txVector.GetGuardInterval (), 2);
pkt->AddHeader (heSig);
LSigHeader sig;
uint16_t length = ((ceil ((static_cast<double> (txDuration.GetNanoSeconds () - (20 * 1000)) / 1000) / 4.0) * 3) - 3 - 1);
sig.SetLength (length);
pkt->AddHeader (sig);
WifiPhyTag tag (txVector.GetPreambleType (), txVector.GetMode ().GetModulationClass (), 1);
pkt->AddPacketTag (tag);
Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (txPowerDbm), GUARD_WIDTH);
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
txParams->psd = txPowerSpectrum;
txParams->txPhy = 0;
txParams->duration = txDuration;
txParams->packet = pkt;
m_phy->StartRx (txParams);
}

View File

@@ -29,6 +29,7 @@
#include "ns3/wifi-phy-tag.h"
#include "ns3/wifi-spectrum-signal-parameters.h"
#include "ns3/wifi-utils.h"
#include "ns3/wifi-phy-header.h"
using namespace ns3;
@@ -141,8 +142,13 @@ WifiPhyThresholdsTest::MakeWifiSignal (double txPowerWatts)
pkt->AddHeader (hdr);
pkt->AddTrailer (trailer);
WifiPhyTag tag (txVector, 1);
LSigHeader sig;
pkt->AddHeader (sig);
WifiPhyTag tag (txVector.GetPreambleType (), txVector.GetMode ().GetModulationClass (), 1);
pkt->AddPacketTag (tag);
Ptr<SpectrumValue> txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH);
Ptr<WifiSpectrumSignalParameters> txParams = Create<WifiSpectrumSignalParameters> ();
txParams->psd = txPowerSpectrum;

View File

@@ -45,6 +45,7 @@
#include "ns3/yans-wifi-phy.h"
#include "ns3/mgt-headers.h"
#include "ns3/ht-configuration.h"
#include "ns3/wifi-phy-header.h"
using namespace ns3;
@@ -1366,10 +1367,13 @@ private:
* \param destination address of the destination device
*/
void SendPacketBurst (uint8_t numPackets, Ptr<NetDevice> sourceDevice, Address& destination) const;
uint16_t m_channelWidth;
};
Bug2843TestCase::Bug2843TestCase ()
: TestCase ("Test case for Bug 2843")
: TestCase ("Test case for Bug 2843"),
m_channelWidth (20)
{
}
@@ -1394,13 +1398,24 @@ Bug2843TestCase::StoreDistinctTuple (std::string context, Ptr<SpectrumSignalPar
NS_FATAL_ERROR ("Received Wi-Fi Signal with no WifiPhyTag");
return;
}
WifiTxVector txVector = tag.GetWifiTxVector ();
uint16_t channelWidth = txVector.GetChannelWidth ();
WifiModulationClass modulationClass = txVector.GetMode ().GetModulationClass ();
WifiModulationClass modulationClass = tag.GetModulation ();
WifiPreamble preamble = tag.GetPreambleType ();
if ((modulationClass != WIFI_MOD_CLASS_HT) || (preamble != WIFI_PREAMBLE_HT_GF))
{
LSigHeader sig;
packet->RemoveHeader (sig);
m_channelWidth = 20;
}
if (modulationClass == WIFI_MOD_CLASS_VHT)
{
VhtSigHeader vhtSig;
packet->RemoveHeader (vhtSig);
m_channelWidth = vhtSig.GetChannelWidth ();
}
// Build a tuple and check if seen before (if so store it)
FreqWidthSubbandModulationTuple tupleForCurrentTx = std::make_tuple (startingFreq, channelWidth,
numBands, modulationClass);
FreqWidthSubbandModulationTuple tupleForCurrentTx = std::make_tuple (startingFreq, m_channelWidth, numBands, modulationClass);
bool found = false;
for (std::vector<FreqWidthSubbandModulationTuple>::const_iterator it = m_distinctTuples.begin (); it != m_distinctTuples.end (); it++)
{