wifi: Move to RX only if the PHY header is successfully received

This commit is contained in:
Sébastien Deronne
2020-03-24 09:11:08 +01:00
committed by Sebastien Deronne
parent eee08c00b3
commit 4b97988a68
10 changed files with 204 additions and 115 deletions

View File

@@ -48,7 +48,7 @@ cpp_examples = [
("wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=745", "True", "True"),
("wifi-he-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238", "True", "True"),
("wifi-he-network --simulationTime=0.3 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=223", "True", "True"),
("wifi-simple-ht-hidden-stations --simulationTime=1.5 --enableRts=0 --nMpdus=32 --minExpectedThroughput=50 --maxExpectedThroughput=51", "True", "True"),
("wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=50 --maxExpectedThroughput=51", "True", "True"),
("wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58", "True", "True"),
("wifi-mixed-network --simulationTime=1", "True", "True"),
("wifi-aggregation --simulationTime=1 --verifyResults=1", "True", "True"),

View File

@@ -340,9 +340,17 @@ WifiPhyStateHelper::LogPreviousIdleAndCcaBusyStates (void)
Time ccaBusyStart = Max (m_endTx, m_endRx);
ccaBusyStart = Max (ccaBusyStart, m_startCcaBusy);
ccaBusyStart = Max (ccaBusyStart, m_endSwitching);
m_stateLogger (ccaBusyStart, idleStart - ccaBusyStart, WifiPhyState::CCA_BUSY);
Time ccaBusyDuration = idleStart - ccaBusyStart;
if (ccaBusyDuration.IsStrictlyPositive ())
{
m_stateLogger (ccaBusyStart, ccaBusyDuration, WifiPhyState::CCA_BUSY);
}
}
Time idleDuration = now - idleStart;
if (idleDuration.IsStrictlyPositive ())
{
m_stateLogger (idleStart, idleDuration, WifiPhyState::IDLE);
}
m_stateLogger (idleStart, now - idleStart, WifiPhyState::IDLE);
}
void
@@ -504,7 +512,6 @@ WifiPhyStateHelper::SwitchMaybeToCcaBusy (Time duration)
NotifyMaybeCcaBusyStart (duration);
}
Time now = Simulator::Now ();
m_endCcaBusy = std::max (m_endCcaBusy, now + duration);
switch (GetState ())
{
case WifiPhyState::IDLE:
@@ -519,7 +526,7 @@ WifiPhyStateHelper::SwitchMaybeToCcaBusy (Time duration)
{
m_startCcaBusy = now;
}
m_stateLogger (now, duration, WifiPhyState::CCA_BUSY);
m_endCcaBusy = std::max (m_endCcaBusy, now + duration);
}
void
@@ -569,20 +576,15 @@ WifiPhyStateHelper::SwitchFromSleep (Time duration)
}
void
WifiPhyStateHelper::SwitchFromRxAbort (bool failure)
WifiPhyStateHelper::SwitchFromRxAbort (void)
{
NS_LOG_FUNCTION (this);
NS_ASSERT (IsStateRx ());
if (failure)
{
NotifyRxEndError ();
}
else
{
NotifyRxEndOk ();
}
NotifyRxEndOk ();
DoSwitchFromRx ();
NS_ASSERT (!IsStateRx ());
m_endCcaBusy = Simulator::Now ();
NotifyMaybeCcaBusyStart (Seconds (0));
NS_ASSERT (IsStateIdle ());
}
void

View File

@@ -210,10 +210,8 @@ public:
void SwitchFromSleep (Time duration);
/**
* Abort current reception
*
* \param failure flag to indicate whether RX abortion is due to a failure
*/
void SwitchFromRxAbort (bool failure);
void SwitchFromRxAbort (void);
/**
* Switch to off mode.
*/

View File

@@ -2616,11 +2616,14 @@ WifiPhy::Send (Ptr<const WifiPsdu> psdu, WifiTxVector txVector)
}
void
WifiPhy::StartReceiveHeader (Ptr<Event> event, Time headerPayloadDuration)
WifiPhy::StartReceiveHeader (Ptr<Event> event)
{
NS_LOG_FUNCTION (this << *event << headerPayloadDuration);
NS_LOG_FUNCTION (this << *event);
NS_ASSERT (!IsStateRx ());
NS_ASSERT (m_endPhyRxEvent.IsExpired ());
NS_ASSERT (m_currentEvent != 0);
NS_ASSERT (event->GetStartTime () == m_currentEvent->GetStartTime ());
NS_ASSERT (event->GetEndTime () == m_currentEvent->GetEndTime ());
InterferenceHelper::SnrPer snrPer = m_interference.CalculateNonHtPhyHeaderSnrPer (event);
double snr = snrPer.snr;
@@ -2628,7 +2631,6 @@ WifiPhy::StartReceiveHeader (Ptr<Event> event, Time headerPayloadDuration)
if (!m_preambleDetectionModel || (m_preambleDetectionModel->IsPreambleDetected (event->GetRxPowerW (), snr, m_channelWidth)))
{
m_state->SwitchToRx (headerPayloadDuration);
NotifyRxBegin (event->GetPsdu ());
m_timeLastPreambleDetected = Simulator::Now ();
@@ -2638,12 +2640,14 @@ WifiPhy::StartReceiveHeader (Ptr<Event> event, Time headerPayloadDuration)
{
//No non-HT PHY header for HT GF
Time remainingPreambleHeaderDuration = CalculatePhyPreambleAndHeaderDuration (txVector) - GetPreambleDetectionDuration ();
m_state->SwitchMaybeToCcaBusy (remainingPreambleHeaderDuration);
m_endPhyRxEvent = Simulator::Schedule (remainingPreambleHeaderDuration, &WifiPhy::StartReceivePayload, this, event);
}
else
{
//Schedule end of non-HT PHY header
Time remainingPreambleAndNonHtHeaderDuration = GetPhyPreambleDuration (txVector) + GetPhyHeaderDuration (txVector) - GetPreambleDetectionDuration ();
m_state->SwitchMaybeToCcaBusy (remainingPreambleAndNonHtHeaderDuration);
m_endPhyRxEvent = Simulator::Schedule (remainingPreambleAndNonHtHeaderDuration, &WifiPhy::ContinueReceiveHeader, this, event);
}
}
@@ -2653,17 +2657,17 @@ WifiPhy::StartReceiveHeader (Ptr<Event> event, Time headerPayloadDuration)
NotifyRxDrop (event->GetPsdu (), PREAMBLE_DETECT_FAILURE);
m_interference.NotifyRxEnd ();
m_currentEvent = 0;
// Like CCA-SD, CCA-ED is governed by the 4μs CCA window to flag CCA-BUSY
// for any received signal greater than the CCA-ED threshold.
MaybeCcaBusyDuration ();
}
// Like CCA-SD, CCA-ED is governed by the 4μs CCA window to flag CCA-BUSY
// for any received signal greater than the CCA-ED threshold.
MaybeCcaBusyDuration ();
}
void
WifiPhy::ContinueReceiveHeader (Ptr<Event> event)
{
NS_LOG_FUNCTION (this << *event);
NS_ASSERT (IsStateRx ());
NS_ASSERT (m_endPhyRxEvent.IsExpired ());
InterferenceHelper::SnrPer snrPer;
@@ -2673,6 +2677,8 @@ WifiPhy::ContinueReceiveHeader (Ptr<Event> event)
{
NS_LOG_DEBUG ("Received non-HT PHY header");
WifiTxVector txVector = event->GetTxVector ();
Time remainingRxDuration = event->GetEndTime () - Simulator::Now ();
m_state->SwitchMaybeToCcaBusy (remainingRxDuration);
Time remainingPreambleHeaderDuration = CalculatePhyPreambleAndHeaderDuration (txVector) - GetPhyPreambleDuration (txVector) - GetPhyHeaderDuration (txVector);
m_endPhyRxEvent = Simulator::Schedule (remainingPreambleHeaderDuration, &WifiPhy::StartReceivePayload, this, event);
}
@@ -2680,6 +2686,7 @@ WifiPhy::ContinueReceiveHeader (Ptr<Event> event)
{
NS_LOG_DEBUG ("Abort reception because non-HT PHY header reception failed");
AbortCurrentReception (L_SIG_FAILURE);
MaybeCcaBusyDuration ();
}
}
@@ -2768,6 +2775,34 @@ WifiPhy::StartReceivePreamble (Ptr<WifiPpdu> ppdu, double rxPowerW)
}
break;
case WifiPhyState::CCA_BUSY:
if (m_currentEvent != 0)
{
if (m_frameCaptureModel != 0
&& m_frameCaptureModel->IsInCaptureWindow (m_timeLastPreambleDetected)
&& m_frameCaptureModel->CaptureNewFrame (m_currentEvent, event))
{
AbortCurrentReception (FRAME_CAPTURE_PACKET_SWITCH);
NS_LOG_DEBUG ("Switch to new packet");
StartRx (event, rxPowerW);
}
else
{
NS_LOG_DEBUG ("Drop packet because already in Rx (power=" <<
rxPowerW << "W)");
NotifyRxDrop (psdu, NOT_ALLOWED);
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ())
{
//that packet will be noise _after_ the reception of the currently-received packet.
MaybeCcaBusyDuration ();
return;
}
}
}
else
{
StartRx (event, rxPowerW);
}
break;
case WifiPhyState::IDLE:
StartRx (event, rxPowerW);
break;
@@ -2800,7 +2835,6 @@ void
WifiPhy::StartReceivePayload (Ptr<Event> event)
{
NS_LOG_FUNCTION (this << *event);
NS_ASSERT (IsStateRx ());
NS_ASSERT (m_endPhyRxEvent.IsExpired ());
NS_ASSERT (m_endRxEvent.IsExpired ());
WifiTxVector txVector = event->GetTxVector ();
@@ -2838,6 +2872,7 @@ WifiPhy::StartReceivePayload (Ptr<Event> event)
else
{
Time payloadDuration = event->GetEndTime () - event->GetStartTime () - CalculatePhyPreambleAndHeaderDuration (txVector);
m_state->SwitchToRx (payloadDuration);
m_endRxEvent = Simulator::Schedule (payloadDuration, &WifiPhy::EndReceive, this, event);
NS_LOG_DEBUG ("Receiving payload");
if (txMode.GetModulationClass () == WIFI_MOD_CLASS_HE)
@@ -4053,8 +4088,10 @@ WifiPhy::AbortCurrentReception (WifiPhyRxfailureReason reason)
}
NotifyRxDrop (m_currentEvent->GetPsdu (), reason);
m_interference.NotifyRxEnd ();
bool is_failure = (reason != OBSS_PD_CCA_RESET);
m_state->SwitchFromRxAbort (is_failure);
if (reason == OBSS_PD_CCA_RESET)
{
m_state->SwitchFromRxAbort ();
}
m_currentEvent = 0;
}
@@ -4103,8 +4140,7 @@ WifiPhy::StartRx (Ptr<Event> event, double rxPowerW)
{
Time startOfPreambleDuration = GetPreambleDetectionDuration ();
Time remainingRxDuration = event->GetDuration () - startOfPreambleDuration;
m_endPreambleDetectionEvent = Simulator::Schedule (startOfPreambleDuration, &WifiPhy::StartReceiveHeader, this,
event, remainingRxDuration);
m_endPreambleDetectionEvent = Simulator::Schedule (startOfPreambleDuration, &WifiPhy::StartReceiveHeader, this, event);
}
else if ((m_frameCaptureModel != 0) && (rxPowerW > m_currentEvent->GetRxPowerW ()))
{
@@ -4115,8 +4151,7 @@ WifiPhy::StartRx (Ptr<Event> event, double rxPowerW)
m_interference.NotifyRxStart ();
Time startOfPreambleDuration = GetPreambleDetectionDuration ();
Time remainingRxDuration = event->GetDuration () - startOfPreambleDuration;
m_endPreambleDetectionEvent = Simulator::Schedule (startOfPreambleDuration, &WifiPhy::StartReceiveHeader, this,
event, remainingRxDuration);
m_endPreambleDetectionEvent = Simulator::Schedule (startOfPreambleDuration, &WifiPhy::StartReceiveHeader, this, event);
}
else
{

View File

@@ -153,9 +153,8 @@ public:
* Start receiving the PHY header of a PPDU (i.e. after the end of receiving the preamble).
*
* \param event the event holding incoming PPDU's information
* \param headerPayloadDuration the duration needed for the reception of the header and PSDU of the PPDU
*/
void StartReceiveHeader (Ptr<Event> event, Time headerPayloadDuration);
void StartReceiveHeader (Ptr<Event> event);
/**
* Continue receiving the PHY header of a PPDU (i.e. after the end of receiving the non-HT header part).

View File

@@ -38,11 +38,11 @@ WifiPpdu::WifiPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDu
m_channelWidth (txVector.GetChannelWidth ()),
m_txPowerLevel (txVector.GetTxPowerLevel ())
{
NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << frequency);
if (!txVector.IsValid ())
{
return;
}
NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << frequency);
switch (m_modulation)
{
case WIFI_MOD_CLASS_DSSS:

View File

@@ -243,10 +243,10 @@ TestInterBssConstantObssPdAlgo::SetupSimulation ()
Simulator::Schedule (Seconds (2.0) + MicroSeconds (6), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device1, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (6), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device2, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (6), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, ap_device1, WifiPhyState::IDLE);
// All PHYs should be receiving the PHY header if preamble has been detected (always the case in this test).
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device1, WifiPhyState::RX);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device2, WifiPhyState::RX);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, ap_device1, WifiPhyState::RX);
// All PHYs should be receiving the PHY header (i.e. PHY state is CCA_BUSY) if preamble has been detected (always the case in this test).
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device1, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device2, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, ap_device1, WifiPhyState::CCA_BUSY);
// PHYs of AP1 and STA1 should be idle if they were reset by OBSS_PD SR, otherwise they should be receiving.
Simulator::Schedule (Seconds (2.0) + MicroSeconds (50), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device1, expectPhyReset ? WifiPhyState::IDLE : WifiPhyState::RX);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (50), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, ap_device1, expectPhyReset ? WifiPhyState::IDLE : WifiPhyState::RX);
@@ -257,7 +257,7 @@ TestInterBssConstantObssPdAlgo::SetupSimulation ()
// AP2 sends another packet 0.1s later.
Simulator::Schedule (Seconds (2.1), &TestInterBssConstantObssPdAlgo::SendOnePacket, this, ap_device2, sta_device2, m_payloadSize2);
// STA1 sends a packet 100us later. Even though AP2 is still transmitting, STA1 can transmit simultaneously if it's PHY was reset by OBSS_PD SR.
// STA1 sends a packet 90us later. Even though AP2 is still transmitting, STA1 can transmit simultaneously if it's PHY was reset by OBSS_PD SR.
Simulator::Schedule (Seconds (2.1) + MicroSeconds (90), &TestInterBssConstantObssPdAlgo::SendOnePacket, this, sta_device1, ap_device1, m_payloadSize1);
if (expectPhyReset)
{
@@ -266,10 +266,10 @@ TestInterBssConstantObssPdAlgo::SetupSimulation ()
Simulator::Schedule (Seconds (2.1) + MicroSeconds (89), &TestInterBssConstantObssPdAlgo::SetExpectedTxPower, this, expectedTxPower);
}
// Check simultaneous transmissions
Simulator::Schedule (Seconds (2.1) + MicroSeconds (100), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device1, expectPhyReset ? WifiPhyState::TX : WifiPhyState::RX);
Simulator::Schedule (Seconds (2.1) + MicroSeconds (100), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, ap_device1, WifiPhyState::RX);
Simulator::Schedule (Seconds (2.1) + MicroSeconds (100), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device2, WifiPhyState::RX);
Simulator::Schedule (Seconds (2.1) + MicroSeconds (100), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, ap_device2, WifiPhyState::TX);
Simulator::Schedule (Seconds (2.1) + MicroSeconds (100), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device1, expectPhyReset ? WifiPhyState::TX : WifiPhyState::RX);
Simulator::Schedule (Seconds (2.1) + MicroSeconds (100), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, sta_device2, WifiPhyState::RX);
Simulator::Schedule (Seconds (2.1) + MicroSeconds (100), &TestInterBssConstantObssPdAlgo::CheckPhyState, this, ap_device1, expectPhyReset ? WifiPhyState::CCA_BUSY : WifiPhyState::RX);
// Verify transmit power restrictions are not applied if access to the channel is requested after ignored OBSS transmissions.

View File

@@ -297,9 +297,9 @@ SpectrumWifiPhyListenerTest::DoRun (void)
Simulator::Run ();
NS_TEST_ASSERT_MSG_EQ (m_count, 1, "Didn't receive right number of packets");
NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyMaybeCcaBusyStart, 2, "Didn't receive NotifyMaybeCcaBusyStart (preamble deteted + L-SIG received)");
NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxStart, 1, "Didn't receive NotifyRxStart");
NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyRxEndOk, 1, "Didn't receive NotifyRxEnd");
NS_TEST_ASSERT_MSG_EQ (m_listener->m_notifyMaybeCcaBusyStart, 0, "Received NotifyMaybeCcaBusyStart unexpectedly");
Simulator::Destroy ();
delete m_listener;

View File

@@ -218,9 +218,12 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
// otherwise it should be IDLE.
Simulator::Schedule (Seconds (1.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (1.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (1.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us
Simulator::Schedule (Seconds (1.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -234,7 +237,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should move from IDLE to CCA_BUSY
// At 4us, no preamble is successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (2.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (2.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 + 2 = 154.8us
@@ -250,7 +253,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (3.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (3.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm - 3);
// At 4us, STA PHY STATE should move from IDLE to CCA_BUSY
// At 4us, no preamble is successfully detected, hence STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (3.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (3.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 + 2 = 154.8us
@@ -265,9 +268,12 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (4.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (4.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm - 6);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (4.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (4.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (4.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (4.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (4.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us.
// However, since there is a second packet transmitted with a power above CCA-ED (-62 dBm), PHY should first be seen as CCA_BUSY for 2us.
Simulator::Schedule (Seconds (4.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
@@ -284,7 +290,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (5.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (5.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm + 3);
// At 4us, STA PHY STATE should move from IDLE to CCA_BUSY
// At 4us, no preamble is successfully detected, hence STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (5.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (5.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 + 2 = 154.8us
@@ -301,9 +307,12 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
// otherwise it should be IDLE.
Simulator::Schedule (Seconds (6.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (6.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (6.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us
Simulator::Schedule (Seconds (6.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -316,7 +325,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (7.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (7.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (7.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// No more packet should have been successfully received, and since preamble detection did not pass the packet should not have been counted as a failure
Simulator::Schedule (Seconds (7.1), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckRxPacketCount, this, 2, 1);
@@ -327,7 +336,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (8.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (8.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm - 3);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (8.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// No more packet should have been successfully received, and since preamble detection did not pass the packet should not have been counted as a failure
Simulator::Schedule (Seconds (8.1), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckRxPacketCount, this, 2, 1);
@@ -338,9 +347,12 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (9.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (9.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm - 6);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (9.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (9.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (9.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (9.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (9.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us.
Simulator::Schedule (Seconds (9.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (9.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -353,7 +365,7 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (10.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (10.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm + 3);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (10.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// No more packet should have been successfully received, and since preamble detection did not pass the packet should not have been counted as a failure
Simulator::Schedule (Seconds (10.1), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckRxPacketCount, this, 2, 2);
@@ -364,9 +376,12 @@ TestThresholdPreambleDetectionWithoutFrameCapture::DoRun (void)
rxPowerDbm = -81;
Simulator::Schedule (Seconds (11.0), &TestThresholdPreambleDetectionWithoutFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (11.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (11.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (11.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (11.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (11.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us.
Simulator::Schedule (Seconds (11.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (11.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithoutFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -560,9 +575,12 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
// otherwise it should be IDLE.
Simulator::Schedule (Seconds (1.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (1.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (1.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us
Simulator::Schedule (Seconds (1.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -576,7 +594,7 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should move from IDLE to CCA_BUSY
// At 4us, no preamble is successfully detected, hence STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (2.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (2.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 + 2 = 154.8us
@@ -592,7 +610,7 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (3.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (3.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm - 3);
// At 4us, STA PHY STATE should move from IDLE to CCA_BUSY
// At 4us, no preamble is successfully detected, hence STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (3.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (3.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 + 2 = 154.8us
@@ -607,9 +625,12 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (4.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (4.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm - 6);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (4.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (4.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (4.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (4.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (4.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us.
// However, since there is a second packet transmitted with a power above CCA-ED (-62 dBm), PHY should first be seen as CCA_BUSY for 2us.
Simulator::Schedule (Seconds (4.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
@@ -626,7 +647,7 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (5.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (5.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm + 3);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (5.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// At 6us, STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (5.0) + NanoSeconds (5999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -644,11 +665,14 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (6.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (6.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm + 6);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (6.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// At 6us, STA PHY STATE should move from IDLE to RX
// At 6us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (6.0) + NanoSeconds (5999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (6000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (6000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 46us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (6.0) + NanoSeconds (45999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (46000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 + 2 = 154.8us
Simulator::Schedule (Seconds (6.0) + NanoSeconds (154799), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (154800), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -662,7 +686,7 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (7.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (7.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should move from IDLE to CCA_BUSY
// At 4us, no preamble is successfully detected, hence STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (7.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (7.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 + 2 = 154.8us
@@ -678,7 +702,7 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (8.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (8.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm - 3);
// At 4us, STA PHY STATE should move from IDLE to CCA_BUSY
// At 4us, no preamble is successfully detected, hence STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (8.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (8.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 us
@@ -693,9 +717,12 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (9.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (9.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm - 6);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (9.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (9.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (9.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (9.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (9.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packets, PHY should be back to IDLE at time 152.8us.
Simulator::Schedule (Seconds (9.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (9.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -709,7 +736,7 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (10.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (10.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm + 3);
// At 4us, STA PHY STATE should move from IDLE to CCA_BUSY
// At 4us, no preamble is successfully detected, hence STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (10.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (10.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 us
@@ -725,9 +752,12 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (11.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (11.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm + 6);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (11.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (11.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (11.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (11.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (11.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 us
Simulator::Schedule (Seconds (11.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (11.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -742,9 +772,12 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
// otherwise it should be IDLE.
Simulator::Schedule (Seconds (12.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (12.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (12.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (12.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (12.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (12.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us
Simulator::Schedule (Seconds (12.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (12.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -757,7 +790,7 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (13.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (13.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (13.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// No more packet should have been successfully received, and since preamble detection did not pass the packet should not have been counted as a failure
Simulator::Schedule (Seconds (13.1), &TestThresholdPreambleDetectionWithFrameCapture::CheckRxPacketCount, this, 2, 4);
@@ -768,7 +801,7 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (14.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (14.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm - 3);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (14.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// No more packet should have been successfully received, and since preamble detection did not pass the packet should not have been counted as a failure
Simulator::Schedule (Seconds (14.1), &TestThresholdPreambleDetectionWithFrameCapture::CheckRxPacketCount, this, 2, 4);
@@ -779,9 +812,12 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (15.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (15.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm - 6);
// At 4us, STA PHY STATE should move from IDLE to RX
// At 4us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (15.0) + NanoSeconds (3999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (15.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (15.0) + NanoSeconds (4000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (15.0) + NanoSeconds (43999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (15.0) + NanoSeconds (44000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us.
Simulator::Schedule (Seconds (15.0) + NanoSeconds (152799), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (15.0) + NanoSeconds (152800), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -795,9 +831,9 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (16.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (16.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm + 3);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (16.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// At 6us, STA PHY STATE should stay in IDLE
// At 6us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (16.0) + MicroSeconds (6.0), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// No more packet should have been successfully received, and since preamble detection did not pass the packet should not have been counted as a failure
Simulator::Schedule (Seconds (16.1), &TestThresholdPreambleDetectionWithFrameCapture::CheckRxPacketCount, this, 2, 5);
@@ -809,11 +845,14 @@ TestThresholdPreambleDetectionWithFrameCapture::DoRun (void)
Simulator::Schedule (Seconds (17.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (17.0) + MicroSeconds (2.0), &TestThresholdPreambleDetectionWithFrameCapture::SendPacket, this, rxPowerDbm + 6);
// At 4us, STA PHY STATE should stay in IDLE
// At 4us, STA PHY STATE should stay IDLE
Simulator::Schedule (Seconds (17.0) + MicroSeconds (4.0), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
// At 6us, STA PHY STATE should move from IDLE to RX
// At 6us, preamble should be successfully detected and STA PHY STATE should move from IDLE to CCA_BUSY
Simulator::Schedule (Seconds (17.0) + NanoSeconds (5999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
Simulator::Schedule (Seconds (17.0) + NanoSeconds (6000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (17.0) + NanoSeconds (6000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 46us, PHY header should be successfully received and STA PHY STATE should move from CCA_BUSY to RX
Simulator::Schedule (Seconds (17.0) + NanoSeconds (45999), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (17.0) + NanoSeconds (46000), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit each packet, PHY should be back to IDLE at time 152.8 + 2 = 154.8us
Simulator::Schedule (Seconds (17.0) + NanoSeconds (154799), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (17.0) + NanoSeconds (154800), &TestThresholdPreambleDetectionWithFrameCapture::CheckPhyState, this, WifiPhyState::IDLE);
@@ -1213,11 +1252,10 @@ TestPhyHeadersReception::DoRun (void)
Simulator::Schedule (Seconds (1.0), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (1.0) + MicroSeconds (10), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
// At 10 us, STA PHY STATE should be RX.
Simulator::Schedule (Seconds (1.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 24us (end of L-SIG), STA PHY STATE should go to CCA_BUSY because L-SIG reception failed and the total energy is above CCA-ED.
Simulator::Schedule (Seconds (1.0) + NanoSeconds (23999), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (24000), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 10 us, STA PHY STATE should be CCA_BUSY.
Simulator::Schedule (Seconds (1.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us (end of PHY header), STA PHY STATE should not have moved to RX and be kept to CCA_BUSY.
Simulator::Schedule (Seconds (1.0) + NanoSeconds (44000), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8 + 10 = 162.8us.
Simulator::Schedule (Seconds (1.0) + NanoSeconds (162799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (1.0) + NanoSeconds (162800), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::IDLE);
@@ -1227,10 +1265,11 @@ TestPhyHeadersReception::DoRun (void)
Simulator::Schedule (Seconds (2.0), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm - 3);
// At 10 us, STA PHY STATE should be RX.
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 24us (end of L-SIG), STA PHY STATE should be unchanged because L-SIG reception should have succeeded.
Simulator::Schedule (Seconds (2.0) + MicroSeconds (24.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 10 us, STA PHY STATE should be CCA_BUSY.
Simulator::Schedule (Seconds (2.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44us (end of PHY header), STA PHY STATE should have moved to RX since PHY header reception should have succeeded.
Simulator::Schedule (Seconds (2.0) + NanoSeconds (43999), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (2.0) + NanoSeconds (44000), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us.
// However, since there is a second packet transmitted with a power above CCA-ED (-62 dBm), PHY should first be seen as CCA_BUSY for 10us.
Simulator::Schedule (Seconds (2.0) + NanoSeconds (152799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
@@ -1243,11 +1282,11 @@ TestPhyHeadersReception::DoRun (void)
Simulator::Schedule (Seconds (3.0), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (3.0) + MicroSeconds (25), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
// At 44 us (end of HE-SIG), STA PHY STATE should be RX (even though reception of HE-SIG failed)
Simulator::Schedule (Seconds (3.0) + MicroSeconds (44.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 44us (end of PHY header), STA PHY STATE should not have moved to RX (HE-SIG failed) and be kept to CCA_BUSY.
Simulator::Schedule (Seconds (3.0) + MicroSeconds (44.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// STA PHY STATE should move back to IDLE once the duration estimated from L-SIG has elapsed, i.e. at 152.8us.
// However, since there is a second packet transmitted with a power above CCA-ED (-62 dBm), PHY should first be seen as CCA_BUSY for 25us.
Simulator::Schedule (Seconds (3.0) + NanoSeconds (152799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (3.0) + NanoSeconds (152799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (3.0) + NanoSeconds (152800), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (3.0) + NanoSeconds (177799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (3.0) + NanoSeconds (177800), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::IDLE);
@@ -1257,8 +1296,11 @@ TestPhyHeadersReception::DoRun (void)
Simulator::Schedule (Seconds (4.0), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (4.0) + MicroSeconds (25), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm - 3);
// At 44 us (end of HE-SIG), STA PHY STATE should be RX.
Simulator::Schedule (Seconds (4.0) + MicroSeconds (44.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 10 us, STA PHY STATE should be CCA_BUSY.
Simulator::Schedule (Seconds (4.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44 us (end of HE-SIG), STA PHY STATE should move to RX since the PHY header reception should have succeeded.
Simulator::Schedule (Seconds (4.0) + NanoSeconds (43999), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (4.0) + NanoSeconds (44000), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// STA PHY STATE should move back to IDLE once the duration estimated from L-SIG has elapsed, i.e. at 152.8us.
// However, since there is a second packet transmitted with a power above CCA-ED (-62 dBm), PHY should first be seen as CCA_BUSY for 25us.
Simulator::Schedule (Seconds (4.0) + NanoSeconds (152799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
@@ -1274,10 +1316,10 @@ TestPhyHeadersReception::DoRun (void)
Simulator::Schedule (Seconds (5.0), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (5.0) + MicroSeconds (10), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
// At 10 us, STA PHY STATE should be RX.
Simulator::Schedule (Seconds (5.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 10 us, STA PHY STATE should be CCA_BUSY.
Simulator::Schedule (Seconds (5.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 24us (end of L-SIG), STA PHY STATE should go to IDLE because L-SIG reception failed and the total energy is below CCA-ED.
Simulator::Schedule (Seconds (5.0) + NanoSeconds (23999), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (5.0) + NanoSeconds (23999), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (5.0) + NanoSeconds (24000), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::IDLE);
// CASE 6: send one packet followed by a second one 3 dB weaker between the end of the 4us preamble detection window
@@ -1285,10 +1327,13 @@ TestPhyHeadersReception::DoRun (void)
Simulator::Schedule (Seconds (6.0), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (6.0) + MicroSeconds (10), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm - 3);
// At 10 us, STA PHY STATE should be RX.
Simulator::Schedule (Seconds (6.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 10 us, STA PHY STATE should be CCA_BUSY.
Simulator::Schedule (Seconds (6.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 24us (end of L-SIG), STA PHY STATE should be unchanged because L-SIG reception should have succeeded.
Simulator::Schedule (Seconds (6.0) + MicroSeconds (24.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (6.0) + MicroSeconds (24.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44 us (end of HE-SIG), STA PHY STATE should move to RX since the PHY header reception should have succeeded.
Simulator::Schedule (Seconds (6.0) + NanoSeconds (43999), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (44000), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// Since it takes 152.8us to transmit the packet, PHY should be back to IDLE at time 152.8us.
Simulator::Schedule (Seconds (6.0) + NanoSeconds (152799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (6.0) + NanoSeconds (152800), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::IDLE);
@@ -1298,10 +1343,14 @@ TestPhyHeadersReception::DoRun (void)
Simulator::Schedule (Seconds (7.0), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (7.0) + MicroSeconds (25), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
// At 44 us (end of HE-SIG), STA PHY STATE should be RX (even though reception of HE-SIG failed).
Simulator::Schedule (Seconds (7.0) + MicroSeconds (44.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 10 us, STA PHY STATE should be CCA_BUSY.
Simulator::Schedule (Seconds (7.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 24us (end of L-SIG), STA PHY STATE should be unchanged because L-SIG reception should have succeeded.
Simulator::Schedule (Seconds (7.0) + MicroSeconds (24.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44 us (end of HE-SIG), STA PHY STATE should be not have moved to RX since reception of HE-SIG should have failed.
Simulator::Schedule (Seconds (7.0) + MicroSeconds (44.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// STA PHY STATE should move back to IDLE once the duration estimated from L-SIG has elapsed, i.e. at 152.8us.
Simulator::Schedule (Seconds (7.0) + NanoSeconds (152799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (7.0) + NanoSeconds (152799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (7.0) + NanoSeconds (152800), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::IDLE);
// CASE 8: send one packet followed by a second one 3 dB weaker between the end of L-SIG and the start of HE-SIG of the first packet:
@@ -1309,8 +1358,13 @@ TestPhyHeadersReception::DoRun (void)
Simulator::Schedule (Seconds (8.0), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm);
Simulator::Schedule (Seconds (8.0) + MicroSeconds (25), &TestPhyHeadersReception::SendPacket, this, rxPowerDbm - 3);
// At 44 us (end of HE-SIG), STA PHY STATE should be RX.
Simulator::Schedule (Seconds (8.0) + MicroSeconds (44.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// At 10 us, STA PHY STATE should be CCA_BUSY.
Simulator::Schedule (Seconds (8.0) + MicroSeconds (10.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 24us (end of L-SIG), STA PHY STATE should be unchanged because L-SIG reception should have succeeded.
Simulator::Schedule (Seconds (8.0) + MicroSeconds (24.0), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
// At 44 us (end of HE-SIG), STA PHY STATE should move to RX since the PHY header reception should have succeeded.
Simulator::Schedule (Seconds (8.0) + NanoSeconds (43999), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::CCA_BUSY);
Simulator::Schedule (Seconds (8.0) + NanoSeconds (44000), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
// STA PHY STATE should move back to IDLE once the duration estimated from L-SIG has elapsed, i.e. at 152.8us.
Simulator::Schedule (Seconds (8.0) + NanoSeconds (152799), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::RX);
Simulator::Schedule (Seconds (8.0) + NanoSeconds (152800), &TestPhyHeadersReception::CheckPhyState, this, WifiPhyState::IDLE);

View File

@@ -355,7 +355,8 @@ WifiPhyThresholdsStrongWifiSignalTest::DoRun (void)
NS_TEST_ASSERT_MSG_EQ (m_rxDropped + m_rxFailure, 0, "Packet reception should have been successfull");
NS_TEST_ASSERT_MSG_EQ (m_rxSuccess, 1, "Packet should have been successfully received");
NS_TEST_ASSERT_MSG_EQ (m_stateChanged, 2, "State should have moved to RX then back to IDLE");
NS_TEST_ASSERT_MSG_EQ (m_ccabusyStateCount, 2, "State should have moved to CCA_BUSY once");
NS_TEST_ASSERT_MSG_EQ (m_stateChanged, 4, "State should have moved to CCA_BUSY, then to RX and finally back to IDLE");
NS_TEST_ASSERT_MSG_EQ (m_rxStateCount, 1, "State should have moved to RX once");
NS_TEST_ASSERT_MSG_EQ (m_idleStateCount, 1, "State should have moved to IDLE once");
}
@@ -397,7 +398,7 @@ WifiPhyThresholdsStrongForeignSignalTest::DoRun (void)
Simulator::Destroy ();
NS_TEST_ASSERT_MSG_EQ (m_rxDropped + m_rxSuccess + m_rxFailure, 0, "Reception of non-wifi packet should not be triggered");
NS_TEST_ASSERT_MSG_EQ (m_ccabusyStateCount, 1, "State should have moved to CCA-BUSY");
NS_TEST_ASSERT_MSG_EQ (m_idleStateCount, 1, "State should have moved to CCA-BUSY then back to IDLE");
}
/**