From ebdb0812d95d3778657eb49c73fb8e4b59f2b72c Mon Sep 17 00:00:00 2001 From: Rediet Date: Mon, 1 Apr 2019 11:28:49 +0200 Subject: [PATCH] wifi: Consider A-MPDU as single packet for PHY processing --- examples/wireless/examples-to-run.py | 14 +- src/wifi/model/mac-low.cc | 199 ++++----- src/wifi/model/mac-low.h | 8 - src/wifi/model/wifi-phy-tag.cc | 15 +- src/wifi/model/wifi-phy-tag.h | 9 +- src/wifi/model/wifi-phy.cc | 476 +++++++++++++--------- src/wifi/model/wifi-phy.h | 53 ++- src/wifi/test/spectrum-wifi-phy-test.cc | 5 +- src/wifi/test/wifi-phy-reception-test.cc | 350 +++++++--------- src/wifi/test/wifi-phy-thresholds-test.cc | 5 +- 10 files changed, 558 insertions(+), 576 deletions(-) diff --git a/examples/wireless/examples-to-run.py b/examples/wireless/examples-to-run.py index 60a064ddb..41f72ef0d 100755 --- a/examples/wireless/examples-to-run.py +++ b/examples/wireless/examples-to-run.py @@ -37,18 +37,18 @@ cpp_examples = [ ("ofdm-vht-validation", "True", "True"), ("ofdm-he-validation", "True", "True"), ("80211n-mimo --simulationTime=0.1 --step=10", "True", "True"), - ("ht-wifi-network --simulationTime=0.1 --frequency=5 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=134", "True", "True"), - ("ht-wifi-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=130", "True", "True"), - ("ht-wifi-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"), - ("ht-wifi-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=4.5 --maxExpectedThroughput=128", "True", "True"), - ("vht-wifi-network --simulationTime=0.1 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=607", "True", "True"), + ("ht-wifi-network --simulationTime=0.2 --frequency=5 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=134", "True", "True"), + ("ht-wifi-network --simulationTime=0.2 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=129", "True", "True"), + ("ht-wifi-network --simulationTime=0.2 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"), + ("ht-wifi-network --simulationTime=0.2 --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=127", "True", "True"), + ("vht-wifi-network --simulationTime=0.2 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=637", "True", "True"), ("vht-wifi-network --simulationTime=0.2 --useRts=1", "True", "True"), ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=844", "True", "True"), - ("he-wifi-network --simulationTime=0.25 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033", "True", "True"), + ("he-wifi-network --simulationTime=0.3 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033", "True", "True"), ("he-wifi-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=745", "True", "True"), ("he-wifi-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238", "True", "True"), ("he-wifi-network --simulationTime=4 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=224", "True", "True"), - ("simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60", "True", "True"), + ("simple-ht-hidden-stations --simulationTime=1.5 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60", "True", "True"), ("simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58", "True", "True"), ("mixed-network --simulationTime=1", "True", "True"), ("wifi-aggregation --simulationTime=1 --verifyResults=1", "True", "True"), diff --git a/src/wifi/model/mac-low.cc b/src/wifi/model/mac-low.cc index e69a935ed..50f0cdee0 100644 --- a/src/wifi/model/mac-low.cc +++ b/src/wifi/model/mac-low.cc @@ -1655,88 +1655,21 @@ MacLow::ForwardDown (Ptr psdu, WifiTxVector txVector) { m_cfAckInfo.expectCfAck = true; } - - m_phy->SendPacket (psdu->GetPacket (), txVector); + NS_LOG_DEBUG ("Sending non aggregate MPDU"); } else // S-MPDU or A-MPDU { - uint32_t queueSize = psdu->GetNMpdus (); - bool last = false; - MpduType mpdutype = NORMAL_MPDU; txVector.SetAggregation (true); - - //Add packet tag - AmpduTag ampdutag; - Time delay = Seconds (0); - Time remainingAmpduDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetFrequency ()); - - for (auto& mpdu : *PeekPointer (psdu)) + if (psdu->IsSingle ()) { - Ptr packet = mpdu->GetPacket ()->Copy (); - packet->AddHeader (mpdu->GetHeader ()); - AddWifiMacTrailer (packet); - - if (queueSize == 1) - { - last = true; - mpdutype = LAST_MPDU_IN_AGGREGATE; - } - - MpduAggregator::AddHeaderAndPad (packet, last, psdu->IsSingle ()); - - if (delay.IsZero ()) - { - if (!psdu->IsSingle ()) - { - NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU"); - mpdutype = MPDU_IN_AGGREGATE; - } - else - { - NS_LOG_DEBUG ("Sending S-MPDU"); - mpdutype = NORMAL_MPDU; - } - } - - Time mpduDuration = m_phy->CalculateTxDuration (packet->GetSize (), txVector, m_phy->GetFrequency (), mpdutype, 0); - remainingAmpduDuration -= mpduDuration; - - ampdutag.SetRemainingNbOfMpdus (static_cast (queueSize - 1)); - if (queueSize > 1) - { - ampdutag.SetRemainingAmpduDuration (remainingAmpduDuration); - } - else - { - ampdutag.SetRemainingAmpduDuration (NanoSeconds (0)); - } - packet->AddPacketTag (ampdutag); - - if (delay.IsZero ()) - { - m_phy->SendPacket (packet, txVector, mpdutype); - } - else - { - Simulator::Schedule (delay, &MacLow::SendMpdu, this, packet, txVector, mpdutype); - } - if (queueSize > 1) - { - NS_ASSERT (remainingAmpduDuration > Time (0)); - delay = delay + mpduDuration; - } - - txVector.SetPreambleType (WIFI_PREAMBLE_NONE); - queueSize--; + NS_LOG_DEBUG ("Sending S-MPDU"); + } + else + { + NS_LOG_DEBUG ("Sending A-MPDU"); } } -} - -void -MacLow::SendMpdu (Ptr packet, WifiTxVector txVector, MpduType mpdutype) -{ - NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU"); - m_phy->SendPacket (packet, txVector, mpdutype); + m_phy->SendPacket (psdu->GetPacket (), txVector); } void @@ -1799,9 +1732,7 @@ MacLow::BlockAckTimeout (void) m_currentTxop = 0; m_ampdu = false; uint8_t tid = GetTid (m_currentPacket->GetPayload (0), m_currentPacket->GetHeader (0)); - AmpduTag ampdu; - m_currentPacket->GetPayload (0)->PeekPacketTag (ampdu); - txop->MissedBlockAck (ampdu.GetRemainingNbOfMpdus () + 1); + txop->MissedBlockAck (m_currentPacket->GetNMpdus ()); FlushAggregateQueue (tid); } @@ -2727,14 +2658,16 @@ void MacLow::DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, WifiTxVector txVector, std::vector statusPerMpdu) { NS_LOG_FUNCTION (this); - AmpduTag ampdu; bool normalAck = false; bool ampduSubframe = false; //flag indicating the packet belongs to an A-MPDU and is not a VHT/HE single MPDU - if (aggregatedPacket->RemovePacketTag (ampdu)) + NS_ASSERT (txVector.GetPreambleType () != WIFI_PREAMBLE_NONE); + if (txVector.IsAggregation ()) { ampduSubframe = true; MpduAggregator::DeaggregatedMpdus packets = MpduAggregator::Deaggregate (aggregatedPacket); MpduAggregator::DeaggregatedMpdusCI n = packets.begin (); + auto status = statusPerMpdu.begin (); + NS_ABORT_MSG_IF (packets.size () != statusPerMpdu.size (), "Should have one receive status per MPDU"); WifiMacHeader firsthdr; (*n).first->PeekHeader (firsthdr); @@ -2744,62 +2677,71 @@ MacLow::DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, if (firsthdr.GetAddr1 () == m_self) { bool singleMpdu = (*n).second.GetEof (); - if (singleMpdu) + //Iterate over all MPDUs and notify reception only if status OK + for (; n != packets.end (); ++n, ++status) { - //If the MPDU is sent as a VHT/HE single MPDU (EOF=1 in A-MPDU subframe header), then the responder sends an ACK. - NS_LOG_DEBUG ("Receive S-MPDU"); - ampduSubframe = false; - } - else if (txVector.GetPreambleType () != WIFI_PREAMBLE_NONE || !m_sendAckEvent.IsRunning ()) - { - m_sendAckEvent = Simulator::Schedule (ampdu.GetRemainingAmpduDuration () + GetSifs (), - &MacLow::SendBlockAckAfterAmpdu, this, - firsthdr.GetQosTid (), - firsthdr.GetAddr2 (), - firsthdr.GetDuration (), - txVector, rxSnr); - } - - if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) - { - ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe); - } - else if (firsthdr.IsData () || firsthdr.IsQosData ()) - { - NS_LOG_DEBUG ("Deaggregate packet from " << firsthdr.GetAddr2 () << " with sequence=" << firsthdr.GetSequenceNumber ()); - ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe); - if (firsthdr.IsQosAck ()) + (*n).first->PeekHeader (firsthdr); + NS_ABORT_MSG_IF (firsthdr.GetAddr1 () != m_self, "All MPDUs of A-MPDU should have the same destination address"); + if (*status) //PER and thus CRC check succeeded { - NS_LOG_DEBUG ("Normal Ack"); - normalAck = true; - } - } - else - { - NS_FATAL_ERROR ("Received A-MPDU with invalid first MPDU type"); - } - - if (ampdu.GetRemainingNbOfMpdus () == 0 && !singleMpdu) - { - if (normalAck) - { - //send block Ack - if (firsthdr.IsBlockAckReq ()) + if (singleMpdu) { - NS_FATAL_ERROR ("Sending a BlockAckReq with QosPolicy equal to Normal Ack"); + //If the MPDU is sent as a VHT/HE single MPDU (EOF=1 in A-MPDU subframe header), then the responder sends an ACK. + NS_LOG_DEBUG ("Receive S-MPDU"); + ampduSubframe = false; } - uint8_t tid = firsthdr.GetQosTid (); - AgreementsI it = m_bAckAgreements.find (std::make_pair (firsthdr.GetAddr2 (), tid)); - if (it != m_bAckAgreements.end ()) + else if (!m_sendAckEvent.IsRunning ()) { - /* See section 11.5.3 in IEEE 802.11 for mean of this timer */ - ResetBlockAckInactivityTimerIfNeeded (it->second.first); - NS_LOG_DEBUG ("rx A-MPDU/sendImmediateBlockAck from=" << firsthdr.GetAddr2 ()); - NS_ASSERT (m_sendAckEvent.IsRunning ()); + m_sendAckEvent = Simulator::Schedule (GetSifs (), + &MacLow::SendBlockAckAfterAmpdu, this, + firsthdr.GetQosTid (), + firsthdr.GetAddr2 (), + firsthdr.GetDuration (), + txVector, rxSnr); + } + + if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ()) + { + ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe); + } + else if (firsthdr.IsData () || firsthdr.IsQosData ()) + { + NS_LOG_DEBUG ("Deaggregate packet from " << firsthdr.GetAddr2 () << " with sequence=" << firsthdr.GetSequenceNumber ()); + ReceiveOk ((*n).first, rxSnr, txVector, ampduSubframe); + if (firsthdr.IsQosAck ()) + { + NS_LOG_DEBUG ("Normal Ack"); + normalAck = true; + } } else { - NS_LOG_DEBUG ("There's not a valid agreement for this block ack request."); + NS_FATAL_ERROR ("Received A-MPDU with invalid first MPDU type"); + } + + if (!singleMpdu) + { + if (normalAck) + { + //send block Ack + if (firsthdr.IsBlockAckReq ()) + { + NS_FATAL_ERROR ("Sending a BlockAckReq with QosPolicy equal to Normal Ack"); + } + uint8_t tid = firsthdr.GetQosTid (); + AgreementsI it = m_bAckAgreements.find (std::make_pair (firsthdr.GetAddr2 (), tid)); + if (it != m_bAckAgreements.end ()) + { + /* See section 11.5.3 in IEEE 802.11 for mean of this timer */ + ResetBlockAckInactivityTimerIfNeeded (it->second.first); + NS_LOG_DEBUG ("rx A-MPDU/sendImmediateBlockAck from=" << firsthdr.GetAddr2 ()); + NS_ASSERT (m_sendAckEvent.IsRunning ()); + } + else + { + NS_LOG_DEBUG ("There's not a valid agreement for this block ack request."); + } + } } } } @@ -2807,6 +2749,7 @@ MacLow::DeaggregateAmpduAndReceive (Ptr aggregatedPacket, double rxSnr, } else { + /* Simple MPDU */ ReceiveOk (aggregatedPacket, rxSnr, txVector, ampduSubframe); } } diff --git a/src/wifi/model/mac-low.h b/src/wifi/model/mac-low.h index d5443c957..f64476a4d 100644 --- a/src/wifi/model/mac-low.h +++ b/src/wifi/model/mac-low.h @@ -488,14 +488,6 @@ private: * \param txVector the transmit vector */ void ForwardDown (Ptr psdu, WifiTxVector txVector); - /** - * Forward the MPDU down to WifiPhy for transmission. This is called for each MPDU when MPDU aggregation is used. - * - * \param packet the packet - * \param txVector the transmit vector - * \param mpdutype the MPDU type - */ - void SendMpdu (Ptr packet, WifiTxVector txVector, MpduType mpdutype); /** * Return a TXVECTOR for the RTS frame given the destination. * The function consults WifiRemoteStationManager, which controls the rate diff --git a/src/wifi/model/wifi-phy-tag.cc b/src/wifi/model/wifi-phy-tag.cc index 079a2f121..5f0f4c3ff 100644 --- a/src/wifi/model/wifi-phy-tag.cc +++ b/src/wifi/model/wifi-phy-tag.cc @@ -40,14 +40,13 @@ WifiPhyTag::GetInstanceTypeId (void) const uint32_t WifiPhyTag::GetSerializedSize (void) const { - return (sizeof (WifiTxVector) + 2 + 1); + return (sizeof (WifiTxVector) + 1); } void WifiPhyTag::Serialize (TagBuffer i) const { i.Write ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector)); - i.WriteU16 (static_cast (m_mpduType)); i.WriteU8 (m_frameComplete); } @@ -55,23 +54,21 @@ void WifiPhyTag::Deserialize (TagBuffer i) { i.Read ((uint8_t *)&m_wifiTxVector, sizeof (WifiTxVector)); - m_mpduType = static_cast (i.ReadU16 ()); m_frameComplete = i.ReadU8 (); } void WifiPhyTag::Print (std::ostream &os) const { - os << m_wifiTxVector << " " << m_mpduType << " " << m_frameComplete; + os << m_wifiTxVector << " " << m_frameComplete; } WifiPhyTag::WifiPhyTag () { } -WifiPhyTag::WifiPhyTag (WifiTxVector txVector, MpduType mpdutype, uint8_t frameComplete) +WifiPhyTag::WifiPhyTag (WifiTxVector txVector, uint8_t frameComplete) : m_wifiTxVector (txVector), - m_mpduType (mpdutype), m_frameComplete (frameComplete) { } @@ -82,12 +79,6 @@ WifiPhyTag::GetWifiTxVector (void) const return m_wifiTxVector; } -MpduType -WifiPhyTag::GetMpduType (void) const -{ - return m_mpduType; -} - uint8_t WifiPhyTag::GetFrameComplete (void) const { diff --git a/src/wifi/model/wifi-phy-tag.h b/src/wifi/model/wifi-phy-tag.h index daf4b3a23..2902ca043 100644 --- a/src/wifi/model/wifi-phy-tag.h +++ b/src/wifi/model/wifi-phy-tag.h @@ -50,20 +50,14 @@ public: /** * Constructor * \param txVector the WifiTxVector - * \param mpdutype the mpduType * \param frameComplete the frameComplete */ - WifiPhyTag (WifiTxVector txVector, MpduType mpdutype, uint8_t frameComplete); + WifiPhyTag (WifiTxVector txVector, uint8_t frameComplete); /** * Getter for WifiTxVector parameter * \return the WifiTxVector */ WifiTxVector GetWifiTxVector (void) const; - /** - * Getter for mpduType parameter - * \return mpduType the mpduType - */ - MpduType GetMpduType (void) const; /** * Getter for frameComplete parameter * \return the frameComplete parameter, i.e. 0 if the frame is not complete, 1 otherwise. @@ -79,7 +73,6 @@ public: private: WifiTxVector m_wifiTxVector; ///< wifi transmit vector - MpduType m_mpduType; ///< MPDU type uint8_t m_frameComplete; ///< Used to indicate that TX stopped sending before the end of the frame }; diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index b431846d0..755fba442 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -36,6 +36,7 @@ #include "wifi-net-device.h" #include "ht-configuration.h" #include "he-configuration.h" +#include "mpdu-aggregator.h" namespace ns3 { @@ -376,8 +377,7 @@ WifiPhy::GetTypeId (void) } WifiPhy::WifiPhy () - : m_mpdusNum (0), - m_plcpSuccess (false), + : m_plcpSuccess (false), m_txMpduReferenceNumber (0xffffffff), m_rxMpduReferenceNumber (0xffffffff), m_endRxEvent (), @@ -2340,50 +2340,174 @@ WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, uint16_t fre void WifiPhy::NotifyTxBegin (Ptr packet) { - m_phyTxBeginTrace (packet); + if (IsAmpdu (packet)) + { + std::list> mpdus = MpduAggregator::PeekMpdus (packet); + for (auto & mpdu : mpdus) + { + m_phyTxBeginTrace (mpdu); + } + } + else + { + m_phyTxBeginTrace (packet); + } } void WifiPhy::NotifyTxEnd (Ptr packet) { - m_phyTxEndTrace (packet); + if (IsAmpdu (packet)) + { + std::list> mpdus = MpduAggregator::PeekMpdus (packet); + for (auto & mpdu : mpdus) + { + m_phyTxEndTrace (mpdu); + } + } + else + { + m_phyTxEndTrace (packet); + } } void WifiPhy::NotifyTxDrop (Ptr packet) { - m_phyTxDropTrace (packet); + if (IsAmpdu (packet)) + { + std::list> mpdus = MpduAggregator::PeekMpdus (packet); + for (auto & mpdu : mpdus) + { + m_phyTxDropTrace (mpdu); + } + } + else + { + m_phyTxDropTrace (packet); + } } void WifiPhy::NotifyRxBegin (Ptr packet) { - m_phyRxBeginTrace (packet); + if (IsAmpdu (packet)) + { + std::list> mpdus = MpduAggregator::PeekMpdus (packet); + for (auto & mpdu : mpdus) + { + m_phyRxBeginTrace (mpdu); + } + } + else + { + m_phyRxBeginTrace (packet); + } } void WifiPhy::NotifyRxEnd (Ptr packet) { - m_phyRxEndTrace (packet); + if (IsAmpdu (packet)) + { + std::list> mpdus = MpduAggregator::PeekMpdus (packet); + for (auto & mpdu : mpdus) + { + m_phyRxEndTrace (mpdu); + } + } + else + { + m_phyRxEndTrace (packet); + } } void WifiPhy::NotifyRxDrop (Ptr packet) { - m_phyRxDropTrace (packet); + if (IsAmpdu (packet)) + { + std::list> mpdus = MpduAggregator::PeekMpdus (packet); + for (auto & mpdu : mpdus) + { + m_phyRxDropTrace (mpdu); + } + } + else + { + m_phyRxDropTrace (packet); + } } void WifiPhy::NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, WifiTxVector txVector, - MpduInfo aMpdu, SignalNoiseDbm signalNoise, std::vector statusPerMpdu) + SignalNoiseDbm signalNoise, std::vector statusPerMpdu) { - m_phyMonitorSniffRxTrace (packet, channelFreqMhz, txVector, aMpdu, signalNoise); + MpduInfo aMpdu; + if (txVector.IsAggregation ()) + { + //Expand A-MPDU + aMpdu.mpduRefNumber = ++m_rxMpduReferenceNumber; + std::list> ampduSubframes = MpduAggregator::PeekAmpduSubframes (packet); + size_t numberOfMpdus = ampduSubframes.size (); + NS_ABORT_MSG_IF (statusPerMpdu.size () != numberOfMpdus, "Should have one reception status per MPDU"); + size_t i = 0; + for (const auto & subframe : ampduSubframes) + { + if (!statusPerMpdu.at (i)) //packet received with error, do not hand over to sniffer + { + continue; + } + if (i == (numberOfMpdus - 1)) //single MPDU or last MPDU. TODO: see if still compatible with EOF padding + { + aMpdu.type = LAST_MPDU_IN_AGGREGATE; + } + else + { + aMpdu.type = MPDU_IN_AGGREGATE; + } + m_phyMonitorSniffRxTrace (subframe, channelFreqMhz, txVector, aMpdu, signalNoise); + ++i; + } + } + else + { + aMpdu.type = NORMAL_MPDU; + NS_ABORT_MSG_IF (statusPerMpdu.size () != 1, "Should have one reception status for normal MPDU"); + m_phyMonitorSniffRxTrace (packet, channelFreqMhz, txVector, aMpdu, signalNoise); + } } void -WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu) +WifiPhy::NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, WifiTxVector txVector) { - m_phyMonitorSniffTxTrace (packet, channelFreqMhz, txVector, aMpdu); + MpduInfo aMpdu; + if (txVector.IsAggregation ()) + { + //Expand A-MPDU + aMpdu.mpduRefNumber = ++m_txMpduReferenceNumber; + std::list> ampduSubframes = MpduAggregator::PeekAmpduSubframes (packet); + size_t numberOfMpdus = ampduSubframes.size (); + size_t i = 0; + for (const auto & subframe : ampduSubframes) + { + if (i == (numberOfMpdus - 1)) //single MPDU or last MPDU. TODO: see if still compatible with EOF padding + { + aMpdu.type = LAST_MPDU_IN_AGGREGATE; + } + else + { + aMpdu.type = MPDU_IN_AGGREGATE; + } + m_phyMonitorSniffTxTrace (subframe, channelFreqMhz, txVector, aMpdu); + ++i; + } + } + else + { + aMpdu.type = NORMAL_MPDU; + m_phyMonitorSniffTxTrace (packet, channelFreqMhz, txVector, aMpdu); + } } void @@ -2393,13 +2517,9 @@ WifiPhy::NotifyEndOfHePreamble (HePreambleParameters params) } void -WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype) +WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector) { - NS_LOG_FUNCTION (this << packet << txVector.GetMode () - << txVector.GetMode ().GetDataRate (txVector) - << txVector.GetPreambleType () - << +txVector.GetTxPowerLevel () - << +mpdutype); + NS_LOG_FUNCTION (this << packet << txVector); /* Transmission can happen if: * - we are syncing on a packet. It is the responsibility of the * MAC layer to avoid doing this but the PHY does nothing to @@ -2420,7 +2540,7 @@ WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType m return; } - Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, GetFrequency (), mpdutype, 1); + Time txDuration = CalculateTxDuration (packet->GetSize (), txVector, GetFrequency ()); NS_ASSERT (txDuration.IsStrictlyPositive ()); if (m_endPreambleDetectionEvent.IsRunning ()) @@ -2441,15 +2561,7 @@ WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType m } NotifyTxBegin (packet); - if ((mpdutype == MPDU_IN_AGGREGATE) && (txVector.GetPreambleType () != WIFI_PREAMBLE_NONE)) - { - //send the first MPDU in an MPDU - m_txMpduReferenceNumber++; - } - MpduInfo aMpdu; - aMpdu.type = mpdutype; - aMpdu.mpduRefNumber = m_txMpduReferenceNumber; - NotifyMonitorSniffTx (packet, GetFrequency (), txVector, aMpdu); + NotifyMonitorSniffTx (packet, GetFrequency (), txVector); m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector); Ptr newPacket = packet->Copy (); // obtain non-const Packet @@ -2465,16 +2577,16 @@ WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector, MpduType m { isFrameComplete = 0; } - WifiPhyTag tag (txVector, mpdutype, isFrameComplete); + WifiPhyTag tag (txVector, isFrameComplete); newPacket->AddPacketTag (tag); StartTx (newPacket, txVector, txDuration); } void -WifiPhy::StartReceiveHeader (Ptr packet, WifiTxVector txVector, MpduType mpdutype, Ptr event, Time rxDuration) +WifiPhy::StartReceiveHeader (Ptr packet, WifiTxVector txVector, Ptr event, Time rxDuration) { - NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << +mpdutype); + NS_LOG_FUNCTION (this << packet << txVector << event << rxDuration); NS_ASSERT (!IsStateRx ()); NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); @@ -2483,45 +2595,42 @@ WifiPhy::StartReceiveHeader (Ptr packet, WifiTxVector txVector, MpduType NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per); if (!m_preambleDetectionModel || (m_preambleDetectionModel->IsPreambleDetected (snr, m_channelWidth))) - { - m_state->SwitchToRx (rxDuration); - NotifyRxBegin (packet); + { + m_state->SwitchToRx (rxDuration); + NotifyRxBegin (packet); - m_timeLastPreambleDetected = Simulator::Now (); - - if ((txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) && (txVector.GetPreambleType () == WIFI_PREAMBLE_HT_GF)) - { - //No legacy PHY header for HT GF - Time remainingPreambleHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector) - GetPreambleDetectionDuration (); - m_endPlcpRxEvent = Simulator::Schedule (remainingPreambleHeaderDuration, &WifiPhy::StartReceivePayload, this, - packet, txVector, mpdutype, event); - } - else - { - //Schedule end of legacy PHY header - Time remainingPreambleAndLegacyHeaderDuration = GetPlcpPreambleDuration (txVector) + GetPlcpHeaderDuration (txVector) - GetPreambleDetectionDuration (); - m_endPlcpRxEvent = Simulator::Schedule (remainingPreambleAndLegacyHeaderDuration, &WifiPhy::ContinueReceiveHeader, this, - packet, txVector, mpdutype, event); - } + m_timeLastPreambleDetected = Simulator::Now (); + Time remainingPreambleHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector) - GetPreambleDetectionDuration (); + if ((txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) && (txVector.GetPreambleType () == WIFI_PREAMBLE_HT_GF)) + { + //No legacy PHY header for HT GF + m_endPlcpRxEvent = Simulator::Schedule (remainingPreambleHeaderDuration, &WifiPhy::StartReceivePayload, this, + packet, txVector, event); + } + else + { + //Schedule end of legacy PHY header + Time remainingPreambleAndLegacyHeaderDuration = GetPlcpPreambleDuration (txVector) + GetPlcpHeaderDuration (txVector) - GetPreambleDetectionDuration (); + m_endPlcpRxEvent = Simulator::Schedule (remainingPreambleAndLegacyHeaderDuration, &WifiPhy::ContinueReceiveHeader, this, + packet, txVector, event); + } - NS_ASSERT (m_endRxEvent.IsExpired ()); - m_endRxEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndReceive, this, - packet, txVector.GetPreambleType (), mpdutype, event); - } + NS_ASSERT (m_endRxEvent.IsExpired ()); + m_endRxEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndReceive, this, + packet, txVector, rxDuration - remainingPreambleHeaderDuration, event); + } else - { - NS_LOG_DEBUG ("Drop packet because PHY preamble detection failed"); - NotifyRxDrop (packet); - m_mpdusNum = 0; - m_plcpSuccess = false; - m_interference.NotifyRxEnd (); - } + { + NS_LOG_DEBUG ("Drop packet because PHY preamble detection failed"); + NotifyRxDrop (packet); + m_plcpSuccess = false; + } } void -WifiPhy::ContinueReceiveHeader (Ptr packet, WifiTxVector txVector, MpduType mpdutype, Ptr event) +WifiPhy::ContinueReceiveHeader (Ptr packet, WifiTxVector txVector, Ptr event) { - NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << +mpdutype); + NS_LOG_FUNCTION (this << packet << txVector << event); NS_ASSERT (IsStateRx ()); NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); @@ -2534,7 +2643,7 @@ WifiPhy::ContinueReceiveHeader (Ptr packet, WifiTxVector txVector, MpduT m_plcpSuccess = true; Time remainingPreambleHeaderDuration = CalculatePlcpPreambleAndHeaderDuration (txVector) - GetPlcpPreambleDuration (txVector) - GetPlcpHeaderDuration (txVector); m_endPlcpRxEvent = Simulator::Schedule (remainingPreambleHeaderDuration, &WifiPhy::StartReceivePayload, this, - packet, txVector, mpdutype, event); + packet, txVector, event); } else //legacy PHY header reception failed { @@ -2547,6 +2656,7 @@ WifiPhy::ContinueReceiveHeader (Ptr packet, WifiTxVector txVector, MpduT void WifiPhy::StartReceivePreamble (Ptr packet, double rxPowerW, Time rxDuration) { + NS_LOG_FUNCTION (this << packet << rxPowerW << rxDuration); WifiPhyTag tag; bool found = packet->RemovePacketTag (tag); if (!found) @@ -2597,7 +2707,6 @@ WifiPhy::StartReceivePreamble (Ptr packet, double rxPowerW, Time rxDurat } } - MpduType mpdutype = tag.GetMpduType (); switch (m_state->GetState ()) { case WifiPhyState::SWITCHING: @@ -2628,7 +2737,7 @@ WifiPhy::StartReceivePreamble (Ptr packet, double rxPowerW, Time rxDurat { AbortCurrentReception (); NS_LOG_DEBUG ("Switch to new packet"); - StartRx (packet, txVector, mpdutype, rxPowerW, rxDuration, event); + StartRx (packet, txVector, rxPowerW, rxDuration, event); } else { @@ -2658,7 +2767,7 @@ WifiPhy::StartReceivePreamble (Ptr packet, double rxPowerW, Time rxDurat break; case WifiPhyState::CCA_BUSY: case WifiPhyState::IDLE: - StartRx (packet, txVector, mpdutype, rxPowerW, rxDuration, event); + StartRx (packet, txVector, rxPowerW, rxDuration, event); break; case WifiPhyState::SLEEP: NS_LOG_DEBUG ("Drop packet because in sleep mode"); @@ -2687,9 +2796,9 @@ WifiPhy::MaybeCcaBusyDuration () } void -WifiPhy::StartReceivePayload (Ptr packet, WifiTxVector txVector, MpduType mpdutype, Ptr event) +WifiPhy::StartReceivePayload (Ptr packet, WifiTxVector txVector, Ptr event) { - NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetPreambleType () << +mpdutype); + NS_LOG_FUNCTION (this << packet << txVector << event); NS_ASSERT (IsStateRx ()); NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); WifiMode txMode = txVector.GetMode (); @@ -2733,60 +2842,117 @@ WifiPhy::StartReceivePayload (Ptr packet, WifiTxVector txVector, MpduTyp } void -WifiPhy::EndReceive (Ptr packet, WifiPreamble preamble, MpduType mpdutype, Ptr event) +WifiPhy::EndReceive (Ptr packet, WifiTxVector txVector, Time psduDuration, Ptr event) { - NS_LOG_FUNCTION (this << packet << event); + NS_LOG_FUNCTION (this << packet << txVector << psduDuration << event); NS_ASSERT (IsStateRx ()); NS_ASSERT (event->GetEndTime () == Simulator::Now ()); - InterferenceHelper::SnrPer snrPer; - snrPer = m_interference.CalculatePayloadSnrPer (event, std::make_pair (NanoSeconds (0), Simulator::Now () - event->GetStartTime ())); //TODO update with correct MPDU relative start and stop times - m_interference.NotifyRxEnd (); - m_currentEvent = 0; + double snr = m_interference.CalculateSnr (event); + std::vector statusPerMpdu; + SignalNoiseDbm signalNoise; + Time relativeStart = NanoSeconds (0); if (m_plcpSuccess == true) { - NS_LOG_DEBUG ("mode=" << (event->GetPayloadMode ().GetDataRate (event->GetTxVector ())) << - ", snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per << ", size=" << packet->GetSize ()); - - // - // There are two error checks: PER and receive error model check. - // PER check models is typical for Wi-Fi and is based on signal modulation; - // Receive error model is optional, if we have an error model and - // it indicates that the packet is corrupt, drop the packet. - // - if (m_random->GetValue () > snrPer.per && - !(m_postReceptionErrorModel && m_postReceptionErrorModel->IsCorrupt (packet))) + bool receptionOkAtLeastForOneMpdu = true; + std::pair rxInfo; + if (txVector.IsAggregation ()) { - NotifyRxEnd (packet); - SignalNoiseDbm signalNoise; - signalNoise.signal = WToDbm (event->GetRxPowerW ()); - signalNoise.noise = WToDbm (event->GetRxPowerW () / snrPer.snr); - MpduInfo aMpdu; - aMpdu.type = mpdutype; - aMpdu.mpduRefNumber = m_rxMpduReferenceNumber; - std::vector statusPerMpdu {true}; //TODO update when A-MPDUs are handled as single packet - NotifyMonitorSniffRx (packet, GetFrequency (), event->GetTxVector (), aMpdu, signalNoise, statusPerMpdu); - m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), statusPerMpdu); + //Extract all MPDUs of the A-MPDU to compute per-MPDU PER stats + //TODO remove PLCP header first + std::list> ampduSubframes = MpduAggregator::PeekAmpduSubframes (packet); + size_t nbOfRemainingMpdus = ampduSubframes.size (); + Time remainingAmpduDuration = psduDuration; + + MpduType mpdutype = (nbOfRemainingMpdus == 1) ? NORMAL_MPDU : MPDU_IN_AGGREGATE; + WifiTxVector tempTxVector = txVector; //transient solution (to remove once WIFI_PREAMBLE_NONE has been cleaned up) + + for (const auto & subframe : ampduSubframes) + { + Time mpduDuration = GetPayloadDuration (subframe->GetSize (), tempTxVector, GetFrequency (), mpdutype, 1); + remainingAmpduDuration -= mpduDuration; + --nbOfRemainingMpdus; + if (nbOfRemainingMpdus == 0 && !remainingAmpduDuration.IsZero ()) //no more MPDU coming + { + mpduDuration += remainingAmpduDuration; //apply a correction just in case rounding had induced slight shift + } + rxInfo = GetReceptionStatus (MpduAggregator::PeekMpduInAmpduSubframe (subframe), txVector, relativeStart, mpduDuration, event); + NS_LOG_DEBUG ("Extracted MPDU #" << ampduSubframes.size () - nbOfRemainingMpdus - 1 << ": duration: " << mpduDuration.GetNanoSeconds () << "ns" << + ", correct reception: " << rxInfo.first << + ", Signal/Noise: " << rxInfo.second.signal << "/" << rxInfo.second.noise << "dBm"); + signalNoise = rxInfo.second; //same information for all MPDUs + statusPerMpdu.push_back (rxInfo.first); + receptionOkAtLeastForOneMpdu |= rxInfo.first; + + relativeStart += mpduDuration; + tempTxVector.SetPreambleType (WIFI_PREAMBLE_NONE); + } } else { - /* failure. */ - NotifyRxDrop (packet); - m_state->SwitchFromRxEndError (packet, snrPer.snr); + //Simple MPDU + rxInfo = GetReceptionStatus (packet, txVector, relativeStart, psduDuration, event); + signalNoise = rxInfo.second; //same information for all MPDUs + statusPerMpdu.push_back (rxInfo.first); + receptionOkAtLeastForOneMpdu = rxInfo.first; + } + + if (receptionOkAtLeastForOneMpdu) + { + NotifyMonitorSniffRx (packet, GetFrequency (), txVector, signalNoise, statusPerMpdu); + m_state->SwitchFromRxEndOk (packet, snr, txVector, statusPerMpdu); + } + else + { + m_state->SwitchFromRxEndError (packet, snr); } } else { - m_state->SwitchFromRxEndError (packet, snrPer.snr); + /* failure of whole PSDU because of PLCP preamble/header error */ + m_state->SwitchFromRxEndError (packet, snr); } - if ((mpdutype == NORMAL_MPDU) || (preamble == WIFI_PREAMBLE_NONE && mpdutype == LAST_MPDU_IN_AGGREGATE)) + m_interference.NotifyRxEnd (); + + m_currentEvent = 0; + m_plcpSuccess = false; +} + +std::pair +WifiPhy::GetReceptionStatus (Ptr mpdu, WifiTxVector txVector, Time relativeMpduStart, Time mpduDuration, Ptr event) +{ + NS_LOG_FUNCTION (this << mpdu << txVector << relativeMpduStart << mpduDuration << event); + InterferenceHelper::SnrPer snrPer; + snrPer = m_interference.CalculatePayloadSnrPer (event, std::make_pair (relativeMpduStart, relativeMpduStart + mpduDuration)); + + NS_LOG_DEBUG ("mode=" << (txVector.GetMode ().GetDataRate (txVector)) << + ", snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per << ", size=" << mpdu->GetSize () << + ", relativeStart = " << relativeMpduStart.GetNanoSeconds () << "ns, duration = " << mpduDuration.GetNanoSeconds () << "ns"); + + // + // There are two error checks: PER and receive error model check. + // PER check models is typical for Wi-Fi and is based on signal modulation; + // Receive error model is optional, if we have an error model and + // it indicates that the packet is corrupt, drop the packet. + // + SignalNoiseDbm signalNoise; + signalNoise.signal = WToDbm (event->GetRxPowerW ()); + signalNoise.noise = WToDbm (event->GetRxPowerW () / snrPer.snr); + if (m_random->GetValue () > snrPer.per && + !(m_postReceptionErrorModel && m_postReceptionErrorModel->IsCorrupt (mpdu->Copy ()))) { - m_plcpSuccess = false; - m_mpdusNum = 0; + NS_LOG_DEBUG ("Reception OK: " << mpdu->ToString ()); + NotifyRxEnd (mpdu); + return std::make_pair (true, signalNoise); + } + else + { + NS_LOG_DEBUG ("Reception failed: " << mpdu->ToString ()); + NotifyRxDrop (mpdu); + return std::make_pair (false, signalNoise); } - } @@ -3821,95 +3987,41 @@ WifiPhy::AbortCurrentReception () m_state->SwitchFromRxAbort (); m_currentEvent = 0; m_plcpSuccess = false; - m_mpdusNum = 0; } void -WifiPhy::StartRx (Ptr packet, WifiTxVector txVector, MpduType mpdutype, double rxPowerW, Time rxDuration, Ptr event) +WifiPhy::StartRx (Ptr packet, WifiTxVector txVector, double rxPowerW, Time rxDuration, Ptr event) { - NS_LOG_FUNCTION (this << packet << txVector << +mpdutype << rxPowerW << rxDuration); - - AmpduTag ampduTag; - WifiPreamble preamble = txVector.GetPreambleType (); - if (preamble == WIFI_PREAMBLE_NONE && (m_mpdusNum == 0 || m_plcpSuccess == false)) - { - m_plcpSuccess = false; - m_mpdusNum = 0; - NS_LOG_DEBUG ("drop packet because no PLCP preamble/header has been received"); - NotifyRxDrop (packet); - MaybeCcaBusyDuration (); - return; - } + NS_LOG_FUNCTION (this << packet << txVector << rxPowerW << rxDuration); + NS_ABORT_MSG_IF (txVector.GetPreambleType () == WIFI_PREAMBLE_NONE, "Packet should have PLCP preamble"); NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)"); m_interference.NotifyRxStart (); //We need to notify it now so that it starts recording events - if (preamble == WIFI_PREAMBLE_NONE) + if (!m_endPreambleDetectionEvent.IsRunning ()) { - NS_ASSERT (m_endPreambleDetectionEvent.IsExpired ()); - - if (packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0) - { - //received the other MPDUs that are part of the A-MPDU - if (ampduTag.GetRemainingNbOfMpdus () < (m_mpdusNum - 1)) - { - NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetRemainingNbOfMpdus ()); - m_mpdusNum = ampduTag.GetRemainingNbOfMpdus (); - } - else - { - m_mpdusNum--; - } - } - - m_state->SwitchToRx (rxDuration); - NotifyRxBegin (packet); - - NS_ASSERT (m_endRxEvent.IsExpired ()); - m_endRxEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndReceive, this, - packet, txVector.GetPreambleType (), mpdutype, event); + m_plcpSuccess = false; + Time startOfPreambleDuration = GetPreambleDetectionDuration (); + Time remainingRxDuration = rxDuration - startOfPreambleDuration; + m_endPreambleDetectionEvent = Simulator::Schedule (startOfPreambleDuration, &WifiPhy::StartReceiveHeader, this, + packet, txVector, event, remainingRxDuration); + } + else if ((m_frameCaptureModel != 0) && (rxPowerW > m_currentEvent->GetRxPowerW ())) + { + NS_LOG_DEBUG ("Received a stronger signal during preamble detection: drop current packet and switch to new packet"); + NotifyRxDrop (m_currentEvent->GetPacket ()); + m_interference.NotifyRxEnd (); + m_endPreambleDetectionEvent.Cancel (); + m_plcpSuccess = false; + m_interference.NotifyRxStart (); + Time startOfPreambleDuration = GetPreambleDetectionDuration (); + Time remainingRxDuration = rxDuration - startOfPreambleDuration; + m_endPreambleDetectionEvent = Simulator::Schedule (startOfPreambleDuration, &WifiPhy::StartReceiveHeader, this, + packet, txVector, event, remainingRxDuration); } else { - if (!m_endPreambleDetectionEvent.IsRunning ()) - { - m_plcpSuccess = false; - m_mpdusNum = 0; - if (packet->PeekPacketTag (ampduTag)) - { - m_mpdusNum = ampduTag.GetRemainingNbOfMpdus (); - NS_LOG_DEBUG ("Received the first MPDU in an A-MPDU, remaining number of MPDUs to be received: " << m_mpdusNum); - m_rxMpduReferenceNumber++; - } - Time startOfPreambleDuration = GetPreambleDetectionDuration (); - Time remainingRxDuration = rxDuration - startOfPreambleDuration; - m_endPreambleDetectionEvent = Simulator::Schedule (startOfPreambleDuration, &WifiPhy::StartReceiveHeader, this, - packet, txVector, mpdutype, event, remainingRxDuration); - } - else if ((m_frameCaptureModel != 0) && (rxPowerW > m_currentEvent->GetRxPowerW ())) - { - NS_LOG_DEBUG ("Received a stronger signal during preamble detection: drop current packet and switch to new packet"); - NotifyRxDrop (m_currentEvent->GetPacket ()); - m_interference.NotifyRxEnd (); - m_endPreambleDetectionEvent.Cancel (); - m_plcpSuccess = false; - m_mpdusNum = 0; - if (packet->PeekPacketTag (ampduTag)) - { - m_mpdusNum = ampduTag.GetRemainingNbOfMpdus (); - NS_LOG_DEBUG ("Received the first MPDU in an A-MPDU, remaining number of MPDUs to be received: " << m_mpdusNum); - m_rxMpduReferenceNumber++; - } - m_interference.NotifyRxStart (); - Time startOfPreambleDuration = GetPreambleDetectionDuration (); - Time remainingRxDuration = rxDuration - startOfPreambleDuration; - m_endPreambleDetectionEvent = Simulator::Schedule (startOfPreambleDuration, &WifiPhy::StartReceiveHeader, this, - packet, txVector, mpdutype, event, remainingRxDuration); - } - else - { - NS_LOG_DEBUG ("Drop packet because RX is already decoding preamble"); - NotifyRxDrop (packet); - } + NS_LOG_DEBUG ("Drop packet because RX is already decoding preamble"); + NotifyRxDrop (packet); } m_currentEvent = event; } diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 5f86322db..5cca46397 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -137,12 +137,10 @@ public: * * \param packet the arriving packet * \param txVector the TXVECTOR of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param event the corresponding event of the first time the packet arrives */ void StartReceiveHeader (Ptr packet, WifiTxVector txVector, - MpduType mpdutype, Ptr event, Time rxDuration); @@ -151,12 +149,10 @@ public: * * \param packet the arriving packet * \param txVector the TXVECTOR of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param event the corresponding event of the first time the packet arrives */ void ContinueReceiveHeader (Ptr packet, WifiTxVector txVector, - MpduType mpdutype, Ptr event); /** @@ -164,32 +160,32 @@ public: * * \param packet the arriving packet * \param txVector the TXVECTOR of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param event the corresponding event of the first time the packet arrives */ void StartReceivePayload (Ptr packet, WifiTxVector txVector, - MpduType mpdutype, Ptr event); /** * The last bit of the packet has arrived. * * \param packet the packet that the last bit has arrived - * \param preamble the preamble of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. + * \param txVector the TXVECTOR of the arriving packet + * \param psduDuration the duration of the PSDU * \param event the corresponding event of the first time the packet arrives */ - void EndReceive (Ptr packet, WifiPreamble preamble, MpduType mpdutype, Ptr event); + void EndReceive (Ptr packet, + WifiTxVector txVector, + Time psduDuration, + Ptr event); /** * \param packet the packet to send * \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send * this packet, and txPowerLevel, a power level to use to send this packet. The real transmission * power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels - * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. */ - void SendPacket (Ptr packet, WifiTxVector txVector, MpduType mpdutype = NORMAL_MPDU); + void SendPacket (Ptr packet, WifiTxVector txVector); /** * \param packet the packet to send @@ -1145,6 +1141,9 @@ public: /** * Public method used to fire a MonitorSniffer trace for a wifi packet being received. * Implemented for encapsulation purposes. + * This method will extract all MPDUs if packet is an A-MPDU and will fire tracedCallback. + * The A-MPDU reference number (RX side) is set within the method. It must be a different value + * for each A-MPDU but the same for each subframe within one A-MPDU. * * \param packet the packet being received * \param channelFreqMhz the frequency in MHz at which the packet is @@ -1155,15 +1154,12 @@ public: * tuned on a given channel and still to be able to receive packets * on a nearby channel. * \param txVector the TXVECTOR that holds rx parameters - * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU) - * and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU) * \param signalNoise signal power and noise power in dBm (noise power includes the noise figure) * \param statusPerMpdu reception status per MPDU */ void NotifyMonitorSniffRx (Ptr packet, uint16_t channelFreqMhz, WifiTxVector txVector, - MpduInfo aMpdu, SignalNoiseDbm signalNoise, std::vector statusPerMpdu); @@ -1195,18 +1191,18 @@ public: /** * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted. * Implemented for encapsulation purposes. + * This method will extract all MPDUs if packet is an A-MPDU and will fire tracedCallback. + * The A-MPDU reference number (RX side) is set within the method. It must be a different value + * for each A-MPDU but the same for each subframe within one A-MPDU. * * \param packet the packet being transmitted * \param channelFreqMhz the frequency in MHz at which the packet is * transmitted. * \param txVector the TXVECTOR that holds tx parameters - * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU) - * and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU) */ void NotifyMonitorSniffTx (Ptr packet, uint16_t channelFreqMhz, - WifiTxVector txVector, - MpduInfo aMpdu); + WifiTxVector txVector); /** * TracedCallback signature for monitor mode transmit events. @@ -1583,8 +1579,7 @@ protected: Ptr m_random; //!< Provides uniform random variables. Ptr m_state; //!< Pointer to WifiPhyStateHelper - uint16_t m_mpdusNum; //!< carries the number of expected mpdus that are part of an A-MPDU - bool m_plcpSuccess; //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received + bool m_plcpSuccess; //!< Flag if the PLCP of the packet has been received uint32_t m_txMpduReferenceNumber; //!< A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU uint32_t m_rxMpduReferenceNumber; //!< A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU @@ -1703,17 +1698,31 @@ private: * * \param packet the arriving packet * \param txVector the TXVECTOR of the arriving packet - * \param mpdutype the type of the MPDU as defined in WifiPhy::MpduType. * \param rxPowerW the receive power in W * \param rxDuration the duration needed for the reception of the packet * \param event the corresponding event of the first time the packet arrives */ void StartRx (Ptr packet, WifiTxVector txVector, - MpduType mpdutype, double rxPowerW, Time rxDuration, Ptr event); + /** + * Get the reception status for the provided MPDU and notify. + * + * \param mpdu the arriving MPDU + * \param txVector the TXVECTOR of the arriving packet + * \param relativeMpduStart the relative start time of the MPDU within the A-MPDU. 0 for normal MPDUs + * \param mpduDuration the duration of the MPDU + * \param event the corresponding event of the first time the packet arrives + * + * \return information on MPDU reception: status, signal power (dBm), and noise power (in dBm) + */ + std::pair GetReceptionStatus (Ptr mpdu, + WifiTxVector txVector, + Time relativeMpduStart, + Time mpduDuration, + Ptr event); /** * The trace source fired when a packet begins the transmission process on diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index bdcc8f514..b0037fa62 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -106,7 +106,6 @@ Ptr SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts) { WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, WIFI_PREAMBLE_LONG, false, 1, 1, 0, 20, false, false); - MpduType mpdutype = NORMAL_MPDU; Ptr pkt = Create (1000); WifiMacHeader hdr; @@ -115,12 +114,12 @@ SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts) 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 (), mpdutype, 0); + Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency ()); hdr.SetDuration (txDuration); pkt->AddHeader (hdr); pkt->AddTrailer (trailer); - WifiPhyTag tag (txVector, mpdutype, 1); + WifiPhyTag tag (txVector, 1); pkt->AddPacketTag (tag); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, GUARD_WIDTH); Ptr txParams = Create (); diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index c6be7adf3..cb0dad8ad 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -35,6 +35,9 @@ #include "ns3/wifi-utils.h" #include "ns3/threshold-preamble-detection-model.h" #include "ns3/simple-frame-capture-model.h" +#include "ns3/wifi-psdu.h" +#include "ns3/wifi-mac-queue-item.h" +#include "ns3/mpdu-aggregator.h" using namespace ns3; @@ -108,7 +111,6 @@ void TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket (double txPowerDbm) { WifiTxVector txVector = WifiTxVector (WifiPhy::GetHeMcs11 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false, false); - MpduType mpdutype = NORMAL_MPDU; Ptr pkt = Create (1000); WifiMacHeader hdr; @@ -117,12 +119,12 @@ TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket (double txPowerDbm 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 (), mpdutype, 0); + Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency ()); hdr.SetDuration (txDuration); pkt->AddHeader (hdr); pkt->AddTrailer (trailer); - WifiPhyTag tag (txVector, mpdutype, 1); + WifiPhyTag tag (txVector, 1); pkt->AddPacketTag (tag); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (txPowerDbm), GUARD_WIDTH); Ptr txParams = Create (); @@ -308,7 +310,6 @@ void TestThresholdPreambleDetectionWithFrameCapture::SendPacket (double txPowerDbm) { WifiTxVector txVector = WifiTxVector (WifiPhy::GetHeMcs11 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false, false); - MpduType mpdutype = NORMAL_MPDU; Ptr pkt = Create (1000); WifiMacHeader hdr; @@ -317,12 +318,12 @@ TestThresholdPreambleDetectionWithFrameCapture::SendPacket (double txPowerDbm) 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 (), mpdutype, 0); + Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency ()); hdr.SetDuration (txDuration); pkt->AddHeader (hdr); pkt->AddTrailer (trailer); - WifiPhyTag tag (txVector, mpdutype, 1); + WifiPhyTag tag (txVector, 1); pkt->AddPacketTag (tag); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (txPowerDbm), GUARD_WIDTH); Ptr txParams = Create (); @@ -518,7 +519,6 @@ void TestSimpleFrameCaptureModel::SendPacket (double txPowerDbm, uint32_t packetSize) { WifiTxVector txVector = WifiTxVector (WifiPhy::GetHeMcs0 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false, false); - MpduType mpdutype = NORMAL_MPDU; Ptr pkt = Create (packetSize); WifiMacHeader hdr; @@ -527,12 +527,12 @@ TestSimpleFrameCaptureModel::SendPacket (double txPowerDbm, uint32_t packetSize) 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 (), mpdutype, 0); + Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency ()); hdr.SetDuration (txDuration); pkt->AddHeader (hdr); pkt->AddTrailer (trailer); - WifiPhyTag tag (txVector, mpdutype, 1); + WifiPhyTag tag (txVector, 1); pkt->AddPacketTag (tag); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (txPowerDbm), GUARD_WIDTH); Ptr txParams = Create (); @@ -708,6 +708,16 @@ private: * \param p the packet */ void RxDropped (Ptr p); + /** + * Increment reception success bitmap. + * \param size the size of the received packet + */ + void IncrementSuccessBitmap (uint32_t size); + /** + * Increment reception failure bitmap. + * \param size the size of the received packet + */ + void IncrementFailureBitmap (uint32_t size); /** * Reset bitmaps function @@ -715,23 +725,11 @@ private: void ResetBitmaps(); /** - * schedule send MPDU function + * Send A-MPDU with 3 MPDUs of different size (i-th MSDU will have 100 bytes more than (i-1)-th). * \param txPowerDbm the transmit power in dBm - * \param packetSize the size of the packet in bytes - * \param preamble the preamble - * \param mpdutype the MPDU type - * \param remainingNbOfMpdus the remaining number of MPDUs to send after this MPDU + * \param referencePacketSize the reference size of the packets in bytes (i-th MSDU will have 100 bytes more than (i-1)-th) */ - void ScheduleSendMpdu (double txPowerDbm, uint32_t packetSize, WifiPreamble preamble, MpduType mpdutype, uint8_t remainingNbOfMpdus); - /** - * Send MPDU function - * \param txPowerDbm the transmit power in dBm - * \param packetSize the size of the packet in bytes - * \param preamble the preamble - * \param mpdutype the MPDU type - * \param remainingNbOfMpdus the remaining number of MPDUs to send after this MPDU - */ - void SendMpdu (double txPowerDbm, uint32_t packetSize, WifiPreamble preamble, MpduType mpdutype, uint8_t remainingNbOfMpdus); + void SendAmpduWithThreeMpdus (double txPowerDbm, uint32_t referencePacketSize); /** * Check the RX success bitmap for A-MPDU 1 @@ -813,27 +811,54 @@ void TestAmpduReception::RxSuccess (Ptr p, double snr, WifiTxVector txVector, std::vector statusPerMpdu) { NS_LOG_FUNCTION (this << p << snr << txVector); - if (p->GetSize () == 1030) //A-MPDU 1 - MPDU #1 + if (IsAmpdu (p)) + { + std::list> mpdus = MpduAggregator::PeekMpdus (p); + NS_ABORT_MSG_IF (mpdus.size () != statusPerMpdu.size (), "Should have one receive status per MPDU"); + auto rxOkForMpdu = statusPerMpdu.begin (); + for (const auto & mpdu : mpdus) + { + if (*rxOkForMpdu) + { + IncrementSuccessBitmap (mpdu->GetSize ()); + } + else + { + IncrementFailureBitmap (mpdu->GetSize ()); + } + ++rxOkForMpdu; + } + } + else + { + IncrementSuccessBitmap (p->GetSize ()); + } +} + +void +TestAmpduReception::IncrementSuccessBitmap (uint32_t size) +{ + if (size == 1030) //A-MPDU 1 - MPDU #1 { m_rxSuccessBitmapAmpdu1 |= 1; } - else if (p->GetSize () == 1130) //A-MPDU 1 - MPDU #2 + else if (size == 1130) //A-MPDU 1 - MPDU #2 { m_rxSuccessBitmapAmpdu1 |= (1 << 1); } - else if (p->GetSize () == 1230) //A-MPDU 1 - MPDU #3 + else if (size == 1230) //A-MPDU 1 - MPDU #3 { m_rxSuccessBitmapAmpdu1 |= (1 << 2); } - else if (p->GetSize () == 1330) //A-MPDU 2 - MPDU #1 + else if (size == 1330) //A-MPDU 2 - MPDU #1 { m_rxSuccessBitmapAmpdu2 |= 1; } - else if (p->GetSize () == 1430) //A-MPDU 2 - MPDU #2 + else if (size == 1430) //A-MPDU 2 - MPDU #2 { m_rxSuccessBitmapAmpdu2 |= (1 << 1); } - else if (p->GetSize () == 1530) //A-MPDU 2 - MPDU #3 + else if (size == 1530) //A-MPDU 2 - MPDU #3 { m_rxSuccessBitmapAmpdu2 |= (1 << 2); } @@ -843,27 +868,44 @@ void TestAmpduReception::RxFailure (Ptr p) { NS_LOG_FUNCTION (this << p); - if (p->GetSize () == 1030) //A-MPDU 1 - MPDU #1 + if (IsAmpdu (p)) + { + std::list> mpdus = MpduAggregator::PeekMpdus (p); + for (const auto & mpdu : mpdus) + { + IncrementFailureBitmap (mpdu->GetSize ()); + } + } + else + { + IncrementFailureBitmap (p->GetSize ()); + } +} + +void +TestAmpduReception::IncrementFailureBitmap (uint32_t size) +{ + if (size == 1030) //A-MPDU 1 - MPDU #1 { m_rxFailureBitmapAmpdu1 |= 1; } - else if (p->GetSize () == 1130) //A-MPDU 1 - MPDU #2 + else if (size == 1130) //A-MPDU 1 - MPDU #2 { m_rxFailureBitmapAmpdu1 |= (1 << 1); } - else if (p->GetSize () == 1230) //A-MPDU 1 - MPDU #3 + else if (size == 1230) //A-MPDU 1 - MPDU #3 { m_rxFailureBitmapAmpdu1 |= (1 << 2); } - else if (p->GetSize () == 1330) //A-MPDU 2 - MPDU #1 + else if (size == 1330) //A-MPDU 2 - MPDU #1 { m_rxFailureBitmapAmpdu2 |= 1; } - else if (p->GetSize () == 1430) //A-MPDU 2 - MPDU #2 + else if (size == 1430) //A-MPDU 2 - MPDU #2 { m_rxFailureBitmapAmpdu2 |= (1 << 1); } - else if (p->GetSize () == 1530) //A-MPDU 2 - MPDU #3 + else if (size == 1530) //A-MPDU 2 - MPDU #3 { m_rxFailureBitmapAmpdu2 |= (1 << 2); } @@ -947,33 +989,27 @@ TestAmpduReception::CheckPhyState (WifiPhyState expectedState) } void -TestAmpduReception::ScheduleSendMpdu (double txPowerDbm, uint32_t packetSize, WifiPreamble preamble, MpduType mpdutype, uint8_t remainingNbOfMpdus) +TestAmpduReception::SendAmpduWithThreeMpdus (double txPowerDbm, uint32_t referencePacketSize) { - //This is needed to make sure this is the last scheduled event and to avoid the start of an MPDU is triggered before the end of the previous MPDU. - Simulator::ScheduleNow (&TestAmpduReception::SendMpdu, this, txPowerDbm, packetSize, preamble, mpdutype, remainingNbOfMpdus); -} + WifiTxVector txVector = WifiTxVector (WifiPhy::GetHeMcs0 (), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, true, false); -void -TestAmpduReception::SendMpdu (double txPowerDbm, uint32_t packetSize, WifiPreamble preamble, MpduType mpdutype, uint8_t remainingNbOfMpdus) -{ - WifiTxVector txVector = WifiTxVector (WifiPhy::GetHeMcs0 (), 0, preamble, 800, 1, 1, 0, 20, false, false); - - Ptr pkt = Create (packetSize); 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 (), mpdutype, 0); - hdr.SetDuration (txDuration); + + std::vector> mpduList; + for (size_t i = 0; i < 3; ++i) + { + Ptr p = Create (referencePacketSize + i * 100); + mpduList.push_back (Create (p, hdr)); + } + Ptr psdu = Create (mpduList); - pkt->AddHeader (hdr); - pkt->AddTrailer (trailer); - AmpduTag ampdutag; - ampdutag.SetRemainingNbOfMpdus (remainingNbOfMpdus); - pkt->AddPacketTag (ampdutag); - WifiPhyTag tag (txVector, mpdutype, 1); + Time txDuration = m_phy->CalculateTxDuration (psdu->GetSize (), txVector, m_phy->GetFrequency ()); + psdu->SetDuration (txDuration); + Ptr pkt = psdu->GetPacket ()->Copy (); + + WifiPhyTag tag (txVector, 1); pkt->AddPacketTag (tag); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, DbmToW (txPowerDbm), GUARD_WIDTH); Ptr txParams = Create (); @@ -1025,14 +1061,10 @@ TestAmpduReception::DoRun (void) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (1.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (1.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (1.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (1.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm - 100, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (1.0) + MicroSeconds (2), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (1.0) + MicroSeconds (2) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (1.0) + MicroSeconds (2) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (1.0) + MicroSeconds (2), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been ignored. Simulator::Schedule (Seconds (1.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1052,14 +1084,10 @@ TestAmpduReception::DoRun (void) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (2.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (2.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (2.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (2.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (2.0) + MicroSeconds (2), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (2.0) + MicroSeconds (2) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (2.0) + MicroSeconds (2) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (2.0) + MicroSeconds (2), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm - 100, 1300); // All MPDUs of A-MPDU 1 should have been received. Simulator::Schedule (Seconds (2.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000111); @@ -1079,14 +1107,10 @@ TestAmpduReception::DoRun (void) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (3.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (3.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (3.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (3.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm - 100, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (3.0) + MicroSeconds (10), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (3.0) + MicroSeconds (10) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (3.0) + MicroSeconds (10) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (3.0) + MicroSeconds (10), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been ignored. Simulator::Schedule (Seconds (3.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1106,14 +1130,10 @@ TestAmpduReception::DoRun (void) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (4.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (4.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (4.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (4.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (4.0) + MicroSeconds (10), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (4.0) + MicroSeconds (10) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (4.0) + MicroSeconds (10) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (4.0) + MicroSeconds (10), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm - 100, 1300); // All MPDUs of A-MPDU 1 should have been received. Simulator::Schedule (Seconds (4.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000111); @@ -1133,14 +1153,10 @@ TestAmpduReception::DoRun (void) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (5.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (5.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (5.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (5.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm - 100, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (5.0) + MicroSeconds (100), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (5.0) + MicroSeconds (100) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (5.0) + MicroSeconds (100) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (5.0) + MicroSeconds (100), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been ignored. Simulator::Schedule (Seconds (5.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1160,14 +1176,10 @@ TestAmpduReception::DoRun (void) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (6.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (6.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (6.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (6.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (6.0) + MicroSeconds (100), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (6.0) + MicroSeconds (100) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (6.0) + MicroSeconds (100) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (6.0) + MicroSeconds (100), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm - 100, 1300); // All MPDUs of A-MPDU 1 should have been received. Simulator::Schedule (Seconds (6.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000111); @@ -1187,14 +1199,10 @@ TestAmpduReception::DoRun (void) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (7.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (7.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (7.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (7.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm - 100, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (7.0) + NanoSeconds (1100000), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (7.0) + NanoSeconds (1100000) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (7.0) + NanoSeconds (1100000) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (7.0) + NanoSeconds (1100000), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been ignored. Simulator::Schedule (Seconds (7.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1214,14 +1222,10 @@ TestAmpduReception::DoRun (void) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (8.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (8.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (8.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (8.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (8.0) + NanoSeconds (1100000), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (8.0) + NanoSeconds (1100000) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (8.0) + NanoSeconds (1100000) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm - 100, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (8.0) + NanoSeconds (1100000), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm - 100, 1300); // All MPDUs of A-MPDU 1 should have been received. Simulator::Schedule (Seconds (8.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000111); @@ -1241,24 +1245,20 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (9.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (9.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (9.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (9.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (9.0) + MicroSeconds (2), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (9.0) + MicroSeconds (2) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (9.0) + MicroSeconds (2) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (9.0) + MicroSeconds (2), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 3, 1300); // All MPDUs of A-MPDU 1 should have been dropped. Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000000); Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000111); - // MPDUs #1 and #2 of A-MPDU 2 should have been received with errors. M/PDU #3 should have been successfully received (it depends on random stream!) - Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu2, this, 0b00000100); - Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu2, this, 0b00000011); - Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu2, this, 0b00000011); + // All MPDUs of A-MPDU 2 should have been received with errors. + Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu2, this, 0b00000000); + Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu2, this, 0b00000111); + Simulator::Schedule (Seconds (9.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu2, this, 0b00000111); Simulator::Schedule (Seconds (9.2), &TestAmpduReception::ResetBitmaps, this); @@ -1268,14 +1268,10 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (10.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (10.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (10.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (10.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (10.0) + MicroSeconds (2), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (10.0) + MicroSeconds (2) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (10.0) + MicroSeconds (2) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (10.0) + MicroSeconds (2), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been dropped (preamble detection failed). Simulator::Schedule (Seconds (10.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1295,14 +1291,10 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (11.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (11.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (11.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (11.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 3, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (11.0) + MicroSeconds (2), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (11.0) + MicroSeconds (2) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (11.0) + MicroSeconds (2) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (11.0) + MicroSeconds (2), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (11.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1322,18 +1314,14 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (12.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (12.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (12.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (12.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (12.0) + MicroSeconds (10), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (12.0) + MicroSeconds (10) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (12.0) + MicroSeconds (10) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (12.0) + MicroSeconds (10), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 3, 1300); - // All MPDUs of A-MPDU 1 should have been dropped (PHY header reception failed). + // All MPDUs of A-MPDU 1 should have been received with errors (PHY header reception failed and thus incorrect decoding of payload). Simulator::Schedule (Seconds (12.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); - Simulator::Schedule (Seconds (12.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000001); + Simulator::Schedule (Seconds (12.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000111); Simulator::Schedule (Seconds (12.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000111); // All MPDUs of A-MPDU 2 should have been dropped (even though TX power is higher, it is not high enough to get the PHY reception switched) @@ -1349,18 +1337,14 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (13.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (13.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (13.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (13.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (13.0) + MicroSeconds (10), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (13.0) + MicroSeconds (10) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (13.0) + MicroSeconds (10) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (13.0) + MicroSeconds (10), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); - // All MPDUs of A-MPDU 1 should have been dropped (PHY header reception failed). + // All MPDUs of A-MPDU 1 should have been received with errors (PHY header reception failed and thus incorrect decoding of payload). Simulator::Schedule (Seconds (13.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); - Simulator::Schedule (Seconds (13.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000001); + Simulator::Schedule (Seconds (13.1), &TestAmpduReception::CheckRxFailureBitmapAmpdu1, this, 0b00000111); Simulator::Schedule (Seconds (13.1), &TestAmpduReception::CheckRxDroppedBitmapAmpdu1, this, 0b00000111); // All MPDUs of A-MPDU 2 should have been dropped as well. @@ -1376,14 +1360,10 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (14.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (14.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (14.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 3, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (14.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 3, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (14.0) + MicroSeconds (10), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (14.0) + MicroSeconds (10) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (14.0) + MicroSeconds (10) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (14.0) + MicroSeconds (10), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (14.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1403,14 +1383,10 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (15.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (15.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (15.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (15.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (15.0) + MicroSeconds (10), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (15.0) + MicroSeconds (10) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (15.0) + MicroSeconds (10) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (15.0) + MicroSeconds (10), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 6, 1300); // All MPDUs of A-MPDU 1 should have been dropped because PHY reception switched to A-MPDU 2. Simulator::Schedule (Seconds (15.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1430,14 +1406,10 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (16.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (16.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (16.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (16.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 6, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (16.0) + MicroSeconds (10), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (16.0) + MicroSeconds (10) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (16.0) + MicroSeconds (10) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (16.0) + MicroSeconds (10), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been successfully received. Simulator::Schedule (Seconds (16.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000111); @@ -1457,14 +1429,10 @@ TestAmpduReception::DoRun (void) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (17.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (17.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (17.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (17.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (17.0) + MicroSeconds (25), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (17.0) + MicroSeconds (25) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (17.0) + MicroSeconds (25) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (17.0) + MicroSeconds (25), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 6, 1300); // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (17.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1484,14 +1452,10 @@ TestAmpduReception::DoRun (void) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (18.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (18.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (18.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (18.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 6, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (18.0) + MicroSeconds (25), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (18.0) + MicroSeconds (25) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (18.0) + MicroSeconds (25) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (18.0) + MicroSeconds (25), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been successfully received. Simulator::Schedule (Seconds (18.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000111); @@ -1511,14 +1475,10 @@ TestAmpduReception::DoRun (void) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (19.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (19.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (19.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (19.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (19.0) + MicroSeconds (25), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (19.0) + MicroSeconds (25) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (19.0) + MicroSeconds (25) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (19.0) + MicroSeconds (25), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (19.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1538,14 +1498,10 @@ TestAmpduReception::DoRun (void) ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (20.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (20.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (20.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (20.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (20.0) + MicroSeconds (100), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (20.0) + MicroSeconds (100) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (20.0) + MicroSeconds (100) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (20.0) + MicroSeconds (100), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 6, 1300); // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (20.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1565,14 +1521,10 @@ TestAmpduReception::DoRun (void) ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (21.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (21.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (21.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm + 6, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (21.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm + 6, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (21.0) + MicroSeconds (100), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (21.0) + MicroSeconds (100) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (21.0) + MicroSeconds (100) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (21.0) + MicroSeconds (100), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been successfully received. Simulator::Schedule (Seconds (21.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000111); @@ -1592,14 +1544,10 @@ TestAmpduReception::DoRun (void) ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (22.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (22.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (22.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (22.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (22.0) + MicroSeconds (100), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (22.0) + MicroSeconds (100) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (22.0) + MicroSeconds (100) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (22.0) + MicroSeconds (100), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // All MPDUs of A-MPDU 1 should have been received with errors. Simulator::Schedule (Seconds (22.1), &TestAmpduReception::CheckRxSuccessBitmapAmpdu1, this, 0b00000000); @@ -1619,14 +1567,10 @@ TestAmpduReception::DoRun (void) /////////////////////////////////////////////////////////////////////////////// // A-MPDU 1 - Simulator::Schedule (Seconds (23.0), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1000, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (23.0) + NanoSeconds (1004369), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1100, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (23.0) + NanoSeconds (2055172), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1200, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (23.0), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1000); // A-MPDU 2 - Simulator::Schedule (Seconds (23.0) + NanoSeconds (1100000), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1300, WIFI_PREAMBLE_HE_SU, MPDU_IN_AGGREGATE, 2); - Simulator::Schedule (Seconds (23.0) + NanoSeconds (1100000) + NanoSeconds (1283343), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1400, WIFI_PREAMBLE_NONE, MPDU_IN_AGGREGATE, 1); - Simulator::Schedule (Seconds (23.0) + NanoSeconds (1100000) + NanoSeconds (2613120), &TestAmpduReception::ScheduleSendMpdu, this, txPowerDbm, 1500, WIFI_PREAMBLE_NONE, LAST_MPDU_IN_AGGREGATE, 0); + Simulator::Schedule (Seconds (23.0) + NanoSeconds (1100000), &TestAmpduReception::SendAmpduWithThreeMpdus, this, txPowerDbm, 1300); // The first MPDU of A-MPDU 1 should have been successfully received (no interference). // The two other MPDUs failed due to interference and are marked as failure (and dropped). diff --git a/src/wifi/test/wifi-phy-thresholds-test.cc b/src/wifi/test/wifi-phy-thresholds-test.cc index 7f43f38ee..aa1718848 100644 --- a/src/wifi/test/wifi-phy-thresholds-test.cc +++ b/src/wifi/test/wifi-phy-thresholds-test.cc @@ -128,7 +128,6 @@ Ptr WifiPhyThresholdsTest::MakeWifiSignal (double txPowerWatts) { WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, WIFI_PREAMBLE_LONG, false, 1, 1, 0, 20, false, false); - MpduType mpdutype = NORMAL_MPDU; Ptr pkt = Create (1000); WifiMacHeader hdr; @@ -137,12 +136,12 @@ WifiPhyThresholdsTest::MakeWifiSignal (double txPowerWatts) 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 (), mpdutype, 0); + Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency ()); hdr.SetDuration (txDuration); pkt->AddHeader (hdr); pkt->AddTrailer (trailer); - WifiPhyTag tag (txVector, mpdutype, 1); + WifiPhyTag tag (txVector, 1); pkt->AddPacketTag (tag); Ptr txPowerSpectrum = WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity (FREQUENCY, CHANNEL_WIDTH, txPowerWatts, CHANNEL_WIDTH); Ptr txParams = Create ();