diff --git a/src/wave/test/ocb-test-suite.cc b/src/wave/test/ocb-test-suite.cc index 8b290faa8..6172d83da 100644 --- a/src/wave/test/ocb-test-suite.cc +++ b/src/wave/test/ocb-test-suite.cc @@ -387,6 +387,7 @@ OcbWifiMacTestCase::DoRun () Simulator::Destroy (); NS_TEST_ASSERT_MSG_LT (phyrx_time, macassoc_time, "In Sta mode with AP, you cannot associate until receive beacon or AssocResponse frame" ); NS_TEST_ASSERT_MSG_LT (macassoc_time, phytx_time, "In Sta mode with AP, you cannot send data packet until associate" ); + //Are these position tests redundant with time check tests? //NS_TEST_ASSERT_MSG_GT ((phyrx_pos.x - macassoc_pos.x), 0.0, ""); //actually macassoc_pos.x - phytx_pos.x is greater than 0 //however associate switch to send is so fast with less than 100ms diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 9415ec8d4..35bf99ecd 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -2611,27 +2611,12 @@ WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector) heSig.SetNStreams (txVector.GetNss ()); newPacket->AddHeader (heSig); } - uint8_t sigExtention = 0; - if (Is2_4Ghz (GetFrequency ())) - { - sigExtention = 6; - } - uint8_t m = 0; - if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_SU) - { - m = 2; - } - else if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU) - { - m = 1; - } - //Equation 27-11 of IEEE P802.11/D4.0 - uint16_t length = ((ceil ((static_cast (txDuration.GetNanoSeconds () - (20 * 1000) - (sigExtention * 1000)) / 1000) / 4.0) * 3) - 3 - m); if ((txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_DSSS) || (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HR_DSSS)) { DsssSigHeader sig; sig.SetRate (txVector.GetMode ().GetDataRate (22)); - sig.SetLength (length); + Time psduDuration = txDuration - CalculatePlcpPreambleAndHeaderDuration (txVector); + sig.SetLength (psduDuration.GetMicroSeconds ()); newPacket->AddHeader (sig); } else if ((txVector.GetMode ().GetModulationClass () != WIFI_MOD_CLASS_HT) || (txVector.GetPreambleType () != WIFI_PREAMBLE_HT_GF)) @@ -2641,6 +2626,22 @@ WifiPhy::SendPacket (Ptr packet, WifiTxVector txVector) { sig.SetRate (txVector.GetMode ().GetDataRate (GetChannelWidth ()), GetChannelWidth ()); } + uint8_t sigExtention = 0; + if (Is2_4Ghz (GetFrequency ())) + { + sigExtention = 6; + } + uint8_t m = 0; + if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_SU) + { + m = 2; + } + else if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU) + { + m = 1; + } + //Equation 27-11 of IEEE P802.11/D4.0 + uint16_t length = ((ceil ((static_cast (txDuration.GetNanoSeconds () - (20 * 1000) - (sigExtention * 1000)) / 1000) / 4.0) * 3) - 3 - m); sig.SetLength (length); newPacket->AddHeader (sig); }