Skip to content

Commit

Permalink
Merge branch 'wifi-fixes' into 'master'
Browse files Browse the repository at this point in the history
wifi: Misc fixes and code cleanup

Closes #45, nsnam#33, and #27

See merge request nsnam/ns-3-dev!56
  • Loading branch information
Stefano Avallone committed May 11, 2019
2 parents 4d1aace + c0fcc36 commit 21d35ff
Show file tree
Hide file tree
Showing 33 changed files with 3,878 additions and 2,407 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Bugs fixed
- Bug 2893 - lte: GetPgw in helper should be const
- Bug 3027 - lte: S1 signalling is done before RRC connection establishment is finished
- #11 - mobility: Rectangle::GetClosestSide returns the correct side also for positions outside the rectangle
- #27 - wifi: Re-compute the A-MPDU after an RTS/CTS exchange fails
- #33 - wifi: Issues with QosTxop::StartNextPacket
- #35 - Unexpected EDCA performance under virtual collisions for 802.11n
- #45 - Wi-Fi transmits frames outside BlockAck window
- #53 - Token Bank Fair Queue Scheduler is creating a transmit opportunity of 0 bytes
- #54 - RadioBearerStats are not correctly connected

Expand Down
60 changes: 56 additions & 4 deletions examples/wireless/80211e-txop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("80211eTxop");

/**
* Keeps the maximum duration among all TXOPs
*/
struct TxopDurationTracer
{
void Trace (Time startTime, Time duration);
Time m_max {Seconds (0)};
};

void
TxopDurationTracer::Trace (Time startTime, Time duration)
{
if (duration > m_max)
{
m_max = duration;
}
}

int main (int argc, char *argv[])
{
uint32_t payloadSize = 1472; //bytes
Expand Down Expand Up @@ -137,6 +155,15 @@ int main (int argc, char *argv[])
edca = ptr.Get<QosTxop> ();
edca->SetTxopLimit (MicroSeconds (3008));

// Trace TXOP duration for BE on STA1
dev = wifiStaNodes.Get (1)->GetDevice (0);
wifi_dev = DynamicCast<WifiNetDevice> (dev);
wifi_mac = wifi_dev->GetMac ();
wifi_mac->GetAttribute ("BE_Txop", ptr);
edca = ptr.Get<QosTxop> ();
TxopDurationTracer beTxopTracer;
edca->TraceConnectWithoutContext ("TxopTrace", MakeCallback (&TxopDurationTracer::Trace, &beTxopTracer));

//Network C
ssid = Ssid ("network-C");
phy.Set ("ChannelNumber", UintegerValue (44));
Expand All @@ -152,6 +179,15 @@ int main (int argc, char *argv[])
"EnableBeaconJitter", BooleanValue (false));
apDeviceC = wifi.Install (phy, mac, wifiApNodes.Get (2));

// Trace TXOP duration for VI on STA2
dev = wifiStaNodes.Get (2)->GetDevice (0);
wifi_dev = DynamicCast<WifiNetDevice> (dev);
wifi_mac = wifi_dev->GetMac ();
wifi_mac->GetAttribute ("VI_Txop", ptr);
edca = ptr.Get<QosTxop> ();
TxopDurationTracer viTxopTracer;
edca->TraceConnectWithoutContext ("TxopTrace", MakeCallback (&TxopDurationTracer::Trace, &viTxopTracer));

//Network D
ssid = Ssid ("network-D");
phy.Set ("ChannelNumber", UintegerValue (48));
Expand Down Expand Up @@ -325,31 +361,47 @@ int main (int argc, char *argv[])
Simulator::Destroy ();

double throughput = totalPacketsThroughA * payloadSize * 8 / (simulationTime * 1000000.0);
std::cout << "Throughput for AC_BE with default TXOP limit (0ms): " << throughput << " Mbit/s" << '\n';
std::cout << "AC_BE with default TXOP limit (0ms): " << '\n'
<< " Throughput = " << throughput << " Mbit/s" << '\n';
if (verifyResults && (throughput < 28 || throughput > 29))
{
NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
exit (1);
}

throughput = totalPacketsThroughB * payloadSize * 8 / (simulationTime * 1000000.0);
std::cout << "Throughput for AC_BE with non-default TXOP limit (3.008ms): " << throughput << " Mbit/s" << '\n';
std::cout << "AC_BE with non-default TXOP limit (3.008ms): " << '\n'
<< " Throughput = " << throughput << " Mbit/s" << '\n';
if (verifyResults && (throughput < 35.5 || throughput > 36.5))
{
NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
exit (1);
}
std::cout << " Maximum TXOP duration = " << beTxopTracer.m_max.GetMicroSeconds () << " us" << '\n';
if (verifyResults && (beTxopTracer.m_max < MicroSeconds (2700) || beTxopTracer.m_max > MicroSeconds (3008)))
{
NS_LOG_ERROR ("Maximum TXOP duration " << beTxopTracer.m_max << " is not in the expected boundaries!");
exit (1);
}

throughput = totalPacketsThroughC * payloadSize * 8 / (simulationTime * 1000000.0);
std::cout << "Throughput for AC_VI with default TXOP limit (3.008ms): " << throughput << " Mbit/s" << '\n';
std::cout << "AC_VI with default TXOP limit (3.008ms): " << '\n'
<< " Throughput = " << throughput << " Mbit/s" << '\n';
if (verifyResults && (throughput < 36 || throughput > 37))
{
NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
exit (1);
}
std::cout << " Maximum TXOP duration = " << viTxopTracer.m_max.GetMicroSeconds () << " us" << '\n';
if (verifyResults && (viTxopTracer.m_max < MicroSeconds (2700) || viTxopTracer.m_max > MicroSeconds (3008)))
{
NS_LOG_ERROR ("Maximum TXOP duration " << viTxopTracer.m_max << " is not in the expected boundaries!");
exit (1);
}

throughput = totalPacketsThroughD * payloadSize * 8 / (simulationTime * 1000000.0);
std::cout << "Throughput for AC_VI with non-default TXOP limit (0ms): " << throughput << " Mbit/s" << '\n';
std::cout << "AC_VI with non-default TXOP limit (0ms): " << '\n'
<< " Throughput = " << throughput << " Mbit/s" << '\n';
if (verifyResults && (throughput < 31.5 || throughput > 32.5))
{
NS_LOG_ERROR ("Obtained throughput " << throughput << " is not in the expected boundaries!");
Expand Down
1 change: 1 addition & 0 deletions examples/wireless/examples-to-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
("simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58", "True", "True"),
("mixed-network --simulationTime=1", "True", "True"),
("wifi-aggregation --simulationTime=1 --verifyResults=1", "True", "True"),
("wifi-txop-aggregation --simulationTime=1 --verifyResults=1", "True", "True"),
("80211e-txop --simulationTime=1 --verifyResults=1", "True", "True"),
("wifi-multi-tos --simulationTime=1 --nWifi=16 --useRts=1 --useShortGuardInterval=1", "True", "True"),
("wifi-tcp", "True", "True"),
Expand Down
Loading

0 comments on commit 21d35ff

Please sign in to comment.