|
|
| 308 |
MakeBooleanAccessor (&WifiPhy::GetShortPlcpPreambleSupported, |
308 |
MakeBooleanAccessor (&WifiPhy::GetShortPlcpPreambleSupported, |
| 309 |
&WifiPhy::SetShortPlcpPreambleSupported), |
309 |
&WifiPhy::SetShortPlcpPreambleSupported), |
| 310 |
MakeBooleanChecker ()) |
310 |
MakeBooleanChecker ()) |
|
|
311 |
.AddAttribute ("PreambleCaptureEnabled", |
| 312 |
"Whether or not to enable capture at the preamble portion of the packet.", |
| 313 |
BooleanValue (false), |
| 314 |
MakeBooleanAccessor (&WifiPhy::m_doPreambleCapture), |
| 315 |
MakeBooleanChecker ()) |
| 316 |
.AddAttribute ("PayloadCaptureEnabled", |
| 317 |
"Whether or not to enable capture at the payload portion of the packet", |
| 318 |
BooleanValue (false), |
| 319 |
MakeBooleanAccessor (&WifiPhy::m_doPayloadCapture), |
| 320 |
MakeBooleanChecker ()) |
| 311 |
.AddTraceSource ("PhyTxBegin", |
321 |
.AddTraceSource ("PhyTxBegin", |
| 312 |
"Trace source indicating a packet " |
322 |
"Trace source indicating a packet " |
| 313 |
"has begun transmitting over the channel medium", |
323 |
"has begun transmitting over the channel medium", |
|
|
| 883 |
{ |
893 |
{ |
| 884 |
// erase all HtMcs modes from deviceMcsSet |
894 |
// erase all HtMcs modes from deviceMcsSet |
| 885 |
size_t index = m_deviceMcsSet.size () - 1; |
895 |
size_t index = m_deviceMcsSet.size () - 1; |
| 886 |
for (std::vector<WifiMode>::reverse_iterator rit = m_deviceMcsSet.rbegin (); rit != m_deviceMcsSet.rend(); ++rit, --index) |
896 |
for (std::vector<WifiMode>::reverse_iterator rit = m_deviceMcsSet.rbegin (); rit != m_deviceMcsSet.rend (); ++rit, --index) |
| 887 |
{ |
897 |
{ |
| 888 |
if (m_deviceMcsSet[index].GetModulationClass ()== WIFI_MOD_CLASS_HT) |
898 |
if (m_deviceMcsSet[index].GetModulationClass () == WIFI_MOD_CLASS_HT) |
| 889 |
{ |
899 |
{ |
| 890 |
m_deviceMcsSet.erase (m_deviceMcsSet.begin () + index); |
900 |
m_deviceMcsSet.erase (m_deviceMcsSet.begin () + index); |
| 891 |
} |
901 |
} |
|
|
| 999 |
{ |
1009 |
{ |
| 1000 |
if (it->second == f) |
1010 |
if (it->second == f) |
| 1001 |
{ |
1011 |
{ |
| 1002 |
found = true; |
1012 |
found = true; |
| 1003 |
break; |
1013 |
break; |
| 1004 |
} |
1014 |
} |
| 1005 |
++it; |
1015 |
++it; |
| 1006 |
} |
1016 |
} |
|
|
| 1945 |
//check tables 20-35 and 20-36 in the .11n standard to get cases when nes = 2 |
1955 |
//check tables 20-35 and 20-36 in the .11n standard to get cases when nes = 2 |
| 1946 |
double Nes = 1; |
1956 |
double Nes = 1; |
| 1947 |
if (payloadMode.GetUniqueName () == "HtMcs21" |
1957 |
if (payloadMode.GetUniqueName () == "HtMcs21" |
| 1948 |
|| payloadMode.GetUniqueName () == "HtMcs22" |
1958 |
|| payloadMode.GetUniqueName () == "HtMcs22" |
| 1949 |
|| payloadMode.GetUniqueName () == "HtMcs23" |
1959 |
|| payloadMode.GetUniqueName () == "HtMcs23" |
| 1950 |
|| payloadMode.GetUniqueName () == "HtMcs28" |
1960 |
|| payloadMode.GetUniqueName () == "HtMcs28" |
| 1951 |
|| payloadMode.GetUniqueName () == "HtMcs29" |
1961 |
|| payloadMode.GetUniqueName () == "HtMcs29" |
| 1952 |
|| payloadMode.GetUniqueName () == "HtMcs30" |
1962 |
|| payloadMode.GetUniqueName () == "HtMcs30" |
| 1953 |
|| payloadMode.GetUniqueName () == "HtMcs31") |
1963 |
|| payloadMode.GetUniqueName () == "HtMcs31") |
| 1954 |
{ |
1964 |
{ |
| 1955 |
Nes = 2; |
1965 |
Nes = 2; |
| 1956 |
} |
1966 |
} |
|
|
| 2125 |
Time |
2135 |
Time |
| 2126 |
WifiPhy::CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector) |
2136 |
WifiPhy::CalculatePlcpPreambleAndHeaderDuration (WifiTxVector txVector) |
| 2127 |
{ |
2137 |
{ |
| 2128 |
WifiPreamble preamble = txVector.GetPreambleType(); |
2138 |
WifiPreamble preamble = txVector.GetPreambleType (); |
| 2129 |
Time duration = GetPlcpPreambleDuration (txVector) |
2139 |
Time duration = GetPlcpPreambleDuration (txVector) |
| 2130 |
+ GetPlcpHeaderDuration (txVector) |
2140 |
+ GetPlcpHeaderDuration (txVector) |
| 2131 |
+ GetPlcpHtSigHeaderDuration (preamble) |
2141 |
+ GetPlcpHtSigHeaderDuration (preamble) |
|
|
| 2213 |
* - we are idle |
2223 |
* - we are idle |
| 2214 |
*/ |
2224 |
*/ |
| 2215 |
NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ()); |
2225 |
NS_ASSERT (!m_state->IsStateTx () && !m_state->IsStateSwitching ()); |
| 2216 |
|
2226 |
|
| 2217 |
if (txVector.GetNss () > GetMaxSupportedTxSpatialStreams ()) |
2227 |
if (txVector.GetNss () > GetMaxSupportedTxSpatialStreams ()) |
| 2218 |
{ |
2228 |
{ |
| 2219 |
NS_FATAL_ERROR ("Unsupported number of spatial streams!"); |
2229 |
NS_FATAL_ERROR ("Unsupported number of spatial streams!"); |
|
|
| 2252 |
newPacket->RemovePacketTag (oldtag); |
2262 |
newPacket->RemovePacketTag (oldtag); |
| 2253 |
WifiPhyTag tag (txVector, mpdutype); |
2263 |
WifiPhyTag tag (txVector, mpdutype); |
| 2254 |
newPacket->AddPacketTag (tag); |
2264 |
newPacket->AddPacketTag (tag); |
| 2255 |
|
2265 |
|
| 2256 |
StartTx (newPacket, txVector, txDuration); |
2266 |
StartTx (newPacket, txVector, txDuration); |
| 2257 |
} |
2267 |
} |
| 2258 |
|
2268 |
|
|
|
| 2264 |
NS_LOG_FUNCTION (this << packet << WToDbm (rxPowerW) << rxDuration); |
2274 |
NS_LOG_FUNCTION (this << packet << WToDbm (rxPowerW) << rxDuration); |
| 2265 |
AmpduTag ampduTag; |
2275 |
AmpduTag ampduTag; |
| 2266 |
Time endRx = Simulator::Now () + rxDuration; |
2276 |
Time endRx = Simulator::Now () + rxDuration; |
| 2267 |
|
2277 |
|
| 2268 |
WifiPhyTag tag; |
2278 |
WifiPhyTag tag; |
| 2269 |
bool found = packet->RemovePacketTag (tag); |
2279 |
bool found = packet->RemovePacketTag (tag); |
| 2270 |
if (!found) |
2280 |
if (!found) |
|
|
| 2274 |
} |
2284 |
} |
| 2275 |
|
2285 |
|
| 2276 |
WifiTxVector txVector = tag.GetWifiTxVector (); |
2286 |
WifiTxVector txVector = tag.GetWifiTxVector (); |
| 2277 |
|
2287 |
|
| 2278 |
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT |
2288 |
if (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT |
| 2279 |
&& (txVector.GetNss () != (1 + (txVector.GetMode ().GetMcsValue () / 8)))) |
2289 |
&& (txVector.GetNss () != (1 + (txVector.GetMode ().GetMcsValue () / 8)))) |
| 2280 |
{ |
2290 |
{ |
| 2281 |
NS_FATAL_ERROR ("MCS value does not match NSS value: MCS = " << (uint16_t)txVector.GetMode ().GetMcsValue () << ", NSS = " << (uint16_t)txVector.GetNss ()); |
2291 |
NS_FATAL_ERROR ("MCS value does not match NSS value: MCS = " << (uint16_t)txVector.GetMode ().GetMcsValue () << ", NSS = " << (uint16_t)txVector.GetNss ()); |
| 2282 |
} |
2292 |
} |
| 2283 |
|
2293 |
|
| 2284 |
if (txVector.GetNss () > GetMaxSupportedRxSpatialStreams ()) |
2294 |
if (txVector.GetNss () > GetMaxSupportedRxSpatialStreams ()) |
| 2285 |
{ |
2295 |
{ |
| 2286 |
NS_FATAL_ERROR ("Reception ends in failure because of an unsupported number of spatial streams"); |
2296 |
NS_FATAL_ERROR ("Reception ends in failure because of an unsupported number of spatial streams"); |
| 2287 |
} |
2297 |
} |
| 2288 |
|
2298 |
|
| 2289 |
WifiPreamble preamble = txVector.GetPreambleType (); |
2299 |
WifiPreamble preamble = txVector.GetPreambleType (); |
| 2290 |
MpduType mpdutype = tag.GetMpduType (); |
2300 |
MpduType mpdutype = tag.GetMpduType (); |
|
|
| 2314 |
{ |
2324 |
{ |
| 2315 |
//that packet will be noise _after_ the completion of the |
2325 |
//that packet will be noise _after_ the completion of the |
| 2316 |
//channel switching. |
2326 |
//channel switching. |
| 2317 |
goto maybeCcaBusy; |
2327 |
CalculateCcaBusyDuration (); |
| 2318 |
} |
2328 |
} |
| 2319 |
break; |
2329 |
break; |
| 2320 |
case WifiPhy::RX: |
2330 |
case WifiPhy::RX: |
| 2321 |
NS_LOG_DEBUG ("drop packet because already in Rx (power=" << |
2331 |
{ |
| 2322 |
rxPowerW << "W)"); |
2332 |
NS_ASSERT (m_rxPacketEvent != NULL); |
| 2323 |
NotifyRxDrop (packet); |
2333 |
if (m_doPreambleCapture == false |
| 2324 |
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ()) |
2334 |
|| m_doPayloadCapture == false |
| 2325 |
{ |
2335 |
|| preamble == WIFI_PREAMBLE_NONE) |
| 2326 |
//that packet will be noise _after_ the reception of the |
2336 |
{ |
| 2327 |
//currently-received packet. |
2337 |
NS_LOG_DEBUG ("cannot perform frame capture capture"); |
| 2328 |
goto maybeCcaBusy; |
2338 |
NotifyRxDrop (packet); |
| 2329 |
} |
2339 |
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ()) |
| 2330 |
break; |
2340 |
{ |
|
|
2341 |
CalculateCcaBusyDuration (); |
| 2342 |
} |
| 2343 |
break; |
| 2344 |
} |
| 2345 |
|
| 2346 |
Time currentRxStage = Simulator::Now () - m_rxPacketEvent->GetStartTime (); |
| 2347 |
bool doReceptionSwitch = false; |
| 2348 |
if (m_rxPreambleType != WIFI_PREAMBLE_NONE |
| 2349 |
&& currentRxStage < preambleAndHeaderDuration) // still receiving the preamble and plcp header portion of the old packet |
| 2350 |
{ |
| 2351 |
doReceptionSwitch = CheckPreambleCapture (packet, event); |
| 2352 |
} |
| 2353 |
else |
| 2354 |
{ |
| 2355 |
doReceptionSwitch = CheckPayloadCapture (packet, event); |
| 2356 |
} |
| 2357 |
if (doReceptionSwitch) |
| 2358 |
{ |
| 2359 |
NS_LOG_INFO ("The receiver switches to the new packet (rxPowerDbm " << WToDbm (event->GetRxPowerW ()) << ")"); |
| 2360 |
m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &WifiPhy::StartReceivePacket, this, |
| 2361 |
packet, txVector, mpdutype, event); |
| 2362 |
m_endRxEvent = Simulator::Schedule (rxDuration, &WifiPhy::EndReceive, this, |
| 2363 |
packet, preamble, mpdutype, event); |
| 2364 |
m_rxPreambleType = preamble; |
| 2365 |
} |
| 2366 |
break; |
| 2367 |
} |
| 2331 |
case WifiPhy::TX: |
2368 |
case WifiPhy::TX: |
| 2332 |
NS_LOG_DEBUG ("drop packet because already in Tx (power=" << |
2369 |
NS_LOG_DEBUG ("drop packet because already in Tx (power=" << |
| 2333 |
rxPowerW << "W)"); |
2370 |
rxPowerW << "W)"); |
|
|
| 2336 |
{ |
2373 |
{ |
| 2337 |
//that packet will be noise _after_ the transmission of the |
2374 |
//that packet will be noise _after_ the transmission of the |
| 2338 |
//currently-transmitted packet. |
2375 |
//currently-transmitted packet. |
| 2339 |
goto maybeCcaBusy; |
2376 |
CalculateCcaBusyDuration (); |
| 2340 |
} |
2377 |
} |
| 2341 |
break; |
2378 |
break; |
| 2342 |
case WifiPhy::CCA_BUSY: |
2379 |
case WifiPhy::CCA_BUSY: |
|
|
| 2349 |
m_mpdusNum = 0; |
2386 |
m_mpdusNum = 0; |
| 2350 |
NS_LOG_DEBUG ("drop packet because no PLCP preamble/header has been received"); |
2387 |
NS_LOG_DEBUG ("drop packet because no PLCP preamble/header has been received"); |
| 2351 |
NotifyRxDrop (packet); |
2388 |
NotifyRxDrop (packet); |
| 2352 |
goto maybeCcaBusy; |
2389 |
CalculateCcaBusyDuration (); |
| 2353 |
} |
2390 |
} |
| 2354 |
else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0) |
2391 |
else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0) |
| 2355 |
{ |
2392 |
{ |
|
|
| 2387 |
NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); |
2424 |
NS_ASSERT (m_endPlcpRxEvent.IsExpired ()); |
| 2388 |
NotifyRxBegin (packet); |
2425 |
NotifyRxBegin (packet); |
| 2389 |
m_interference.NotifyRxStart (); |
2426 |
m_interference.NotifyRxStart (); |
|
|
2427 |
m_rxPacket = packet; |
| 2428 |
m_rxPacketEvent = event; |
| 2429 |
m_rxPreambleType = preamble; |
| 2390 |
|
2430 |
|
| 2391 |
if (preamble != WIFI_PREAMBLE_NONE) |
2431 |
if (preamble != WIFI_PREAMBLE_NONE) |
| 2392 |
{ |
2432 |
{ |
|
|
| 2405 |
rxPowerW << "<" << GetEdThresholdW () << ")"); |
2445 |
rxPowerW << "<" << GetEdThresholdW () << ")"); |
| 2406 |
NotifyRxDrop (packet); |
2446 |
NotifyRxDrop (packet); |
| 2407 |
m_plcpSuccess = false; |
2447 |
m_plcpSuccess = false; |
| 2408 |
goto maybeCcaBusy; |
2448 |
CalculateCcaBusyDuration (); |
| 2409 |
} |
2449 |
} |
| 2410 |
break; |
2450 |
break; |
| 2411 |
case WifiPhy::SLEEP: |
2451 |
case WifiPhy::SLEEP: |
|
|
| 2416 |
} |
2456 |
} |
| 2417 |
|
2457 |
|
| 2418 |
return; |
2458 |
return; |
| 2419 |
|
2459 |
} |
| 2420 |
maybeCcaBusy: |
2460 |
|
| 2421 |
//We are here because we have received the first bit of a packet and we are |
2461 |
void |
| 2422 |
//not going to be able to synchronize on it |
2462 |
WifiPhy::CalculateCcaBusyDuration () |
| 2423 |
//In this model, CCA becomes busy when the aggregation of all signals as |
2463 |
{ |
| 2424 |
//tracked by the InterferenceHelper class is higher than the CcaBusyThreshold |
2464 |
// maybeCcaBusy: |
|
|
2465 |
//We are here because we have received the first bit of a packet and we are |
| 2466 |
//not going to be able to synchronize on it |
| 2467 |
//In this model, CCA becomes busy when the aggregation of all signals as |
| 2468 |
//tracked by the InterferenceHelper class is higher than the CcaBusyThreshold |
| 2425 |
|
2469 |
|
| 2426 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ())); |
2470 |
Time delayUntilCcaEnd = m_interference.GetEnergyDuration (DbmToW (GetCcaMode1Threshold ())); |
| 2427 |
if (!delayUntilCcaEnd.IsZero ()) |
2471 |
if (!delayUntilCcaEnd.IsZero ()) |
|
|
| 2430 |
} |
2474 |
} |
| 2431 |
} |
2475 |
} |
| 2432 |
|
2476 |
|
|
|
2477 |
bool |
| 2478 |
WifiPhy::CheckPreambleCapture (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event) |
| 2479 |
{ |
| 2480 |
NS_LOG_FUNCTION (this << packet << event); |
| 2481 |
NS_LOG_DEBUG (Simulator::Now () << ", preamble capture check: old reception event start at " |
| 2482 |
<< m_rxPacketEvent->GetStartTime () |
| 2483 |
<< ", old preamble type " << m_rxPreambleType |
| 2484 |
<< ", end at " << m_rxPacketEvent->GetEndTime () |
| 2485 |
<< ", old rxPower " << m_rxPacketEvent->GetRxPowerW ()); |
| 2486 |
bool result = false; |
| 2487 |
Time endRx = event->GetEndTime (); |
| 2488 |
InterferenceHelper::SnrPer snrPer; |
| 2489 |
snrPer = m_interference.CalculatePlcpHeaderSnrPer (m_rxPacketEvent); // check whether the plcp header can still decoded |
| 2490 |
NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per); |
| 2491 |
if (m_random->GetValue () > snrPer.per) // the reception of the old packet can be continued |
| 2492 |
{ |
| 2493 |
NS_ASSERT (m_endPlcpRxEvent.IsRunning ()); |
| 2494 |
NS_LOG_INFO (Simulator::Now () << " preamble capture check: dropping newly arrived packet" |
| 2495 |
<< ", because already sync to a stronger enough signal"); |
| 2496 |
NotifyRxDrop (packet); |
| 2497 |
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ()) |
| 2498 |
{ |
| 2499 |
CalculateCcaBusyDuration (); |
| 2500 |
} |
| 2501 |
} |
| 2502 |
else // the reception of the old packet cannot be continued |
| 2503 |
{ |
| 2504 |
NS_LOG_INFO (Simulator::Now () << " preamble capture check: dropping currently received packet"); |
| 2505 |
AbortCurrentReception (m_rxPacket, snrPer.snr); |
| 2506 |
|
| 2507 |
NS_ASSERT (m_endPlcpRxEvent.IsExpired () && m_endRxEvent.IsExpired ()); |
| 2508 |
NS_LOG_INFO (Simulator::Now () << " preamble capture check: switch to new packet"); |
| 2509 |
|
| 2510 |
InterferenceHelper::SnrPer snrPerForNewPkt; |
| 2511 |
snrPerForNewPkt = m_interference.CalculatePlcpHeaderSnrPer (event); |
| 2512 |
double prob = m_interference.CalculatePreambleCaptureProbability (snrPerForNewPkt.snr); |
| 2513 |
if (m_random->GetValue () < prob) |
| 2514 |
{ |
| 2515 |
SwitchReception (packet, event); |
| 2516 |
result = true; |
| 2517 |
} |
| 2518 |
else |
| 2519 |
{ |
| 2520 |
NS_LOG_INFO (Simulator::Now () << " preamble capture: signal is too low for capture"); |
| 2521 |
NotifyRxDrop (packet); |
| 2522 |
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ()) |
| 2523 |
{ |
| 2524 |
CalculateCcaBusyDuration (); |
| 2525 |
} |
| 2526 |
} |
| 2527 |
} |
| 2528 |
return result; |
| 2529 |
} |
| 2530 |
|
| 2531 |
bool |
| 2532 |
WifiPhy::CheckPayloadCapture (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event) |
| 2533 |
{ |
| 2534 |
NS_LOG_FUNCTION (this << packet << event); |
| 2535 |
NS_LOG_DEBUG (Simulator::Now () << ", payload capture check: old reception event start at " |
| 2536 |
<< m_rxPacketEvent->GetStartTime () |
| 2537 |
<< ", end at " << m_rxPacketEvent->GetEndTime () |
| 2538 |
<< ", old rxPower " << m_rxPacketEvent->GetRxPowerW ()); |
| 2539 |
bool result = false; |
| 2540 |
Time endRx = event->GetEndTime (); |
| 2541 |
InterferenceHelper::SnrPer snrPer; |
| 2542 |
snrPer = m_interference.CalculatePlcpPayloadSnrPer (m_rxPacketEvent); // check whether the plcp header can still decoded |
| 2543 |
NS_LOG_DEBUG ("snr(dB)=" << RatioToDb (snrPer.snr) << ", per=" << snrPer.per); |
| 2544 |
if (m_random->GetValue () > snrPer.per) // the reception of the old packet can be continued |
| 2545 |
{ |
| 2546 |
NS_ASSERT (m_endRxEvent.IsRunning ()); |
| 2547 |
NS_LOG_INFO (Simulator::Now () << " payload capture check: dropping newly arrived packet" |
| 2548 |
<< ", because already sync to a stronger enough signal"); |
| 2549 |
NotifyRxDrop (packet); |
| 2550 |
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ()) |
| 2551 |
{ |
| 2552 |
CalculateCcaBusyDuration (); |
| 2553 |
} |
| 2554 |
} |
| 2555 |
else // the reception of the old packet cannot be continued |
| 2556 |
{ |
| 2557 |
NS_LOG_INFO (Simulator::Now () << " preamble capture check: dropping currently received packet"); |
| 2558 |
AbortCurrentReception (m_rxPacket, snrPer.snr); |
| 2559 |
|
| 2560 |
NS_ASSERT (m_endPlcpRxEvent.IsExpired () && m_endRxEvent.IsExpired ()); |
| 2561 |
NS_LOG_INFO (Simulator::Now () << " payload capture check: switch to new packet"); |
| 2562 |
|
| 2563 |
InterferenceHelper::SnrPer snrPerForNewPkt; |
| 2564 |
snrPerForNewPkt = m_interference.CalculatePlcpPayloadSnrPer (event); |
| 2565 |
double prob = m_interference.CalculatePayloadCaptureProbability (snrPerForNewPkt.snr); |
| 2566 |
if (m_random->GetValue () < prob) |
| 2567 |
{ |
| 2568 |
SwitchReception (packet, event); |
| 2569 |
result = true; |
| 2570 |
} |
| 2571 |
else |
| 2572 |
{ |
| 2573 |
NS_LOG_INFO (Simulator::Now () << " payload capture: signal is too low for capture"); |
| 2574 |
NotifyRxDrop (packet); |
| 2575 |
if (endRx > Simulator::Now () + m_state->GetDelayUntilIdle ()) |
| 2576 |
{ |
| 2577 |
CalculateCcaBusyDuration (); |
| 2578 |
} |
| 2579 |
} |
| 2580 |
} |
| 2581 |
return result; |
| 2582 |
} |
| 2583 |
|
| 2584 |
void |
| 2585 |
WifiPhy::AbortCurrentReception (Ptr<Packet> packet, double sinr) |
| 2586 |
{ |
| 2587 |
NS_LOG_FUNCTION (this << packet << sinr); |
| 2588 |
if (m_endPlcpRxEvent.IsRunning ()) |
| 2589 |
{ |
| 2590 |
m_endPlcpRxEvent.Cancel (); |
| 2591 |
} |
| 2592 |
if (m_endRxEvent.IsRunning ()) |
| 2593 |
{ |
| 2594 |
m_endRxEvent.Cancel (); |
| 2595 |
} |
| 2596 |
m_interference.NotifyRxEnd (); |
| 2597 |
m_state->SwitchFromRxAbort (packet, sinr); |
| 2598 |
m_rxPacket = NULL; |
| 2599 |
m_rxPacketEvent = NULL; |
| 2600 |
m_rxPreambleType = WIFI_PREAMBLE_NONE; |
| 2601 |
} |
| 2602 |
|
| 2603 |
void |
| 2604 |
WifiPhy::SwitchReception (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event) |
| 2605 |
{ |
| 2606 |
NS_LOG_FUNCTION (this << packet << event); |
| 2607 |
m_rxPacket = packet; |
| 2608 |
m_rxPacketEvent = event; |
| 2609 |
m_state->SwitchToRx (event->GetDuration ()); |
| 2610 |
NotifyRxBegin (packet); |
| 2611 |
m_interference.NotifyRxStart (); |
| 2612 |
} |
| 2613 |
|
| 2433 |
void |
2614 |
void |
| 2434 |
WifiPhy::StartReceivePacket (Ptr<Packet> packet, |
2615 |
WifiPhy::StartReceivePacket (Ptr<Packet> packet, |
| 2435 |
WifiTxVector txVector, |
2616 |
WifiTxVector txVector, |
|
|
| 2452 |
{ |
2633 |
{ |
| 2453 |
NS_LOG_DEBUG ("receiving plcp payload"); //endReceive is already scheduled |
2634 |
NS_LOG_DEBUG ("receiving plcp payload"); //endReceive is already scheduled |
| 2454 |
m_plcpSuccess = true; |
2635 |
m_plcpSuccess = true; |
|
|
2636 |
NS_LOG_INFO ("decode plcp successfully (rxPowerDbm " << WToDbm (event->GetRxPowerW ()) << ")"); |
| 2455 |
} |
2637 |
} |
| 2456 |
else //mode is not allowed |
2638 |
else //mode is not allowed |
| 2457 |
{ |
2639 |
{ |
|
|
| 2495 |
aMpdu.mpduRefNumber = m_rxMpduReferenceNumber; |
2677 |
aMpdu.mpduRefNumber = m_rxMpduReferenceNumber; |
| 2496 |
NotifyMonitorSniffRx (packet, GetFrequency (), event->GetTxVector (), aMpdu, signalNoise); |
2678 |
NotifyMonitorSniffRx (packet, GetFrequency (), event->GetTxVector (), aMpdu, signalNoise); |
| 2497 |
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector ()); |
2679 |
m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector ()); |
|
|
2680 |
NS_LOG_INFO ("decode payload successfully (rxPowerDbm " << WToDbm (event->GetRxPowerW ()) << ")"); |
| 2498 |
} |
2681 |
} |
| 2499 |
else |
2682 |
else |
| 2500 |
{ |
2683 |
{ |
|
|
| 3311 |
WifiPhy::IsValidTxVector (WifiTxVector txVector) |
3494 |
WifiPhy::IsValidTxVector (WifiTxVector txVector) |
| 3312 |
{ |
3495 |
{ |
| 3313 |
uint8_t chWidth = txVector.GetChannelWidth (); |
3496 |
uint8_t chWidth = txVector.GetChannelWidth (); |
| 3314 |
uint8_t nss = txVector.GetNss(); |
3497 |
uint8_t nss = txVector.GetNss (); |
| 3315 |
std::string modeName = txVector.GetMode ().GetUniqueName (); |
3498 |
std::string modeName = txVector.GetMode ().GetUniqueName (); |
| 3316 |
|
3499 |
|
| 3317 |
if (chWidth == 20) |
3500 |
if (chWidth == 20) |