|
|
| 493 |
Time symbolDuration; |
493 |
Time symbolDuration; |
| 494 |
double m_Stbc; |
494 |
double m_Stbc; |
| 495 |
//if short GI data rate is used then symbol duration is 3.6us else symbol duration is 4us |
495 |
//if short GI data rate is used then symbol duration is 3.6us else symbol duration is 4us |
| 496 |
//In the future has to create a stationmanager that only uses these data rates if sender and reciever support GI |
496 |
//In the future has to create a stationmanager that only uses these data rates if sender and receiver support GI |
| 497 |
if (txVector.IsShortGuardInterval ()) |
497 |
if (txVector.IsShortGuardInterval ()) |
| 498 |
{ |
498 |
{ |
| 499 |
symbolDuration = NanoSeconds (3600); |
499 |
symbolDuration = NanoSeconds (3600); |
|
|
| 627 |
double numDataBitsPerSymbol = payloadMode.GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ()) * symbolDuration.GetNanoSeconds () / 1e9; |
627 |
double numDataBitsPerSymbol = payloadMode.GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), txVector.GetNss ()) * symbolDuration.GetNanoSeconds () / 1e9; |
| 628 |
double numSymbols; |
628 |
double numSymbols; |
| 629 |
|
629 |
|
|
|
630 |
if(incFlag == 0) |
| 631 |
NS_ASSERT(m_totalAmpduSize == 0); |
| 632 |
|
| 630 |
if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE) |
633 |
if (mpdutype == MPDU_IN_AGGREGATE && preamble != WIFI_PREAMBLE_NONE) |
| 631 |
{ |
634 |
{ |
| 632 |
//First packet in an A-MPDU |
635 |
//First packet in an A-MPDU |
|
|
| 635 |
{ |
638 |
{ |
| 636 |
m_totalAmpduSize += size; |
639 |
m_totalAmpduSize += size; |
| 637 |
m_totalAmpduNumSymbols += numSymbols; |
640 |
m_totalAmpduNumSymbols += numSymbols; |
|
|
641 |
if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT && frequency >= 2400 && frequency <= 2500) //at 2.4 GHz |
| 642 |
{ |
| 643 |
Time mpdu_time = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()) + MicroSeconds (6); |
| 644 |
m_txDurationTime += mpdu_time; |
| 645 |
return mpdu_time; |
| 646 |
} |
| 647 |
else //at 5 GHz |
| 648 |
{ |
| 649 |
Time mpdu_time = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()); |
| 650 |
m_txDurationTime += mpdu_time; |
| 651 |
return mpdu_time; |
| 652 |
} |
| 638 |
} |
653 |
} |
| 639 |
} |
654 |
} |
| 640 |
else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE) |
655 |
else if (mpdutype == MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE) |
|
|
| 645 |
{ |
660 |
{ |
| 646 |
m_totalAmpduSize += size; |
661 |
m_totalAmpduSize += size; |
| 647 |
m_totalAmpduNumSymbols += numSymbols; |
662 |
m_totalAmpduNumSymbols += numSymbols; |
|
|
663 |
if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT && frequency >= 2400 && frequency <= 2500) //at 2.4 GHz |
| 664 |
{ |
| 665 |
Time mpdu_time = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()) + MicroSeconds (6); |
| 666 |
m_txDurationTime += mpdu_time; |
| 667 |
return mpdu_time; |
| 668 |
} |
| 669 |
else //at 5 GHz |
| 670 |
{ |
| 671 |
Time mpdu_time = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()); |
| 672 |
m_txDurationTime += mpdu_time; |
| 673 |
return mpdu_time; |
| 674 |
} |
| 648 |
} |
675 |
} |
| 649 |
} |
676 |
} |
| 650 |
else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE) |
677 |
else if (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE) |
| 651 |
{ |
678 |
{ |
| 652 |
//last packet in an A-MPDU |
679 |
//last packet in an A-MPDU |
| 653 |
uint32_t totalAmpduSize = m_totalAmpduSize + size; |
680 |
uint32_t totalAmpduSize = m_totalAmpduSize + size; |
|
|
681 |
Time totalAmpduTime = Seconds(0); |
| 654 |
numSymbols = lrint (m_Stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol))); |
682 |
numSymbols = lrint (m_Stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol))); |
| 655 |
NS_ASSERT (m_totalAmpduNumSymbols <= numSymbols); |
683 |
if(incFlag == 1){ |
| 656 |
numSymbols -= m_totalAmpduNumSymbols; |
684 |
if (payloadMode.GetModulationClass () == WIFI_MOD_CLASS_HT && frequency >= 2400 && frequency <= 2500) //at 2.4 GHz |
| 657 |
if (incFlag == 1) |
685 |
{ |
| 658 |
{ |
686 |
totalAmpduTime = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()) + MicroSeconds (6); |
|
|
687 |
} |
| 688 |
else //at 5 GHz |
| 689 |
{ |
| 690 |
totalAmpduTime = NanoSeconds (numSymbols * symbolDuration.GetNanoSeconds ()); |
| 691 |
} |
| 692 |
Time lastMpduTime = totalAmpduTime - m_txDurationTime; |
| 693 |
NS_ASSERT (m_totalAmpduNumSymbols <= numSymbols); |
| 659 |
m_totalAmpduSize = 0; |
694 |
m_totalAmpduSize = 0; |
| 660 |
m_totalAmpduNumSymbols = 0; |
695 |
m_totalAmpduNumSymbols = 0; |
| 661 |
} |
696 |
m_txDurationTime = Seconds(0); |
|
|
697 |
return lastMpduTime; |
| 698 |
} |
| 662 |
} |
699 |
} |
| 663 |
else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE) |
700 |
else if (mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE) |
| 664 |
{ |
701 |
{ |