examples: Use Time for duration parameters in wifi examples
This commit is contained in:
@@ -25,7 +25,7 @@ cpp_examples = [
|
||||
("wifi-wired-bridging", "True", "True"),
|
||||
("wifi-sleep", "True", "True"),
|
||||
("wifi-blockack", "True", "True"),
|
||||
("wifi-timing-attributes --simulationTime=1", "True", "True"),
|
||||
("wifi-timing-attributes --simulationTime=1s", "True", "True"),
|
||||
(
|
||||
"wifi-power-adaptation-distance --manager=ns3::ParfWifiManager --outputFileName=parf --steps=5 --stepsSize=10",
|
||||
"True",
|
||||
@@ -63,143 +63,143 @@ cpp_examples = [
|
||||
("wifi-ofdm-vht-validation", "True", "True"),
|
||||
("wifi-ofdm-he-validation", "True", "True"),
|
||||
("wifi-error-models-comparison", "True", "True"),
|
||||
("wifi-80211n-mimo --simulationTime=0.1 --step=10", "True", "True"),
|
||||
("wifi-80211n-mimo --simulationTime=0.1s --step=10", "True", "True"),
|
||||
(
|
||||
"wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=135",
|
||||
"wifi-ht-network --simulationTime=0.2s --frequency=5 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=135",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=132",
|
||||
"wifi-ht-network --simulationTime=0.2s --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=132",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132",
|
||||
"wifi-ht-network --simulationTime=0.2s --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=129",
|
||||
"wifi-ht-network --simulationTime=0.2s --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=129",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-vht-network --simulationTime=0.2 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=620",
|
||||
"wifi-vht-network --simulationTime=0.2s --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=620",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-vht-network --simulationTime=0.2 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=557",
|
||||
"wifi-vht-network --simulationTime=0.2s --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=557",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=844",
|
||||
"wifi-he-network --simulationTime=0.25s --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=844",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033",
|
||||
"wifi-he-network --simulationTime=0.3s --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=745",
|
||||
"wifi-he-network --simulationTime=0.3s --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",
|
||||
"wifi-he-network --simulationTime=0.25s --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",
|
||||
"wifi-he-network --simulationTime=0.3s --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=223",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --minExpectedThroughput=20 --maxExpectedThroughput=212",
|
||||
"wifi-he-network --simulationTime=0.3s --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --minExpectedThroughput=20 --maxExpectedThroughput=212",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --frequency=2.4 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --minExpectedThroughput=21 --maxExpectedThroughput=56",
|
||||
"wifi-he-network --simulationTime=0.3s --frequency=2.4 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --minExpectedThroughput=21 --maxExpectedThroughput=56",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --minExpectedThroughput=31 --maxExpectedThroughput=290",
|
||||
"wifi-he-network --simulationTime=0.3s --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --minExpectedThroughput=31 --maxExpectedThroughput=290",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-he-network --simulationTime=0.3 --udp=1 --downlink=0 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --minExpectedThroughput=46 --maxExpectedThroughput=327",
|
||||
"wifi-he-network --simulationTime=0.3s --udp=1 --downlink=0 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --minExpectedThroughput=46 --maxExpectedThroughput=327",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=760",
|
||||
"wifi-eht-network --simulationTime=0.1s --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=760",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --mpduBufferSize=1024 --frequency2=6 --minExpectedThroughput=7 --maxExpectedThroughput=1444",
|
||||
"wifi-eht-network --simulationTime=0.1s --frequency=5 --useRts=0 --mpduBufferSize=1024 --frequency2=6 --minExpectedThroughput=7 --maxExpectedThroughput=1444",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=660",
|
||||
"wifi-eht-network --simulationTime=0.1s --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=660",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --mpduBufferSize=512 --frequency2=5 --minExpectedThroughput=7 --maxExpectedThroughput=512",
|
||||
"wifi-eht-network --simulationTime=0.1s --frequency=2.4 --useRts=0 --mpduBufferSize=512 --frequency2=5 --minExpectedThroughput=7 --maxExpectedThroughput=512",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=240",
|
||||
"wifi-eht-network --simulationTime=0.1s --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=240",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.23 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=5 --frequency2=6 --minExpectedThroughput=35 --maxExpectedThroughput=404",
|
||||
"wifi-eht-network --simulationTime=0.23s --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=5 --frequency2=6 --minExpectedThroughput=35 --maxExpectedThroughput=404",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.25 --frequency=2.4 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --frequency2=5 --mpduBufferSize=1024 --minExpectedThroughput=50 --maxExpectedThroughput=120",
|
||||
"wifi-eht-network --simulationTime=0.25s --frequency=2.4 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --frequency2=5 --mpduBufferSize=1024 --minExpectedThroughput=50 --maxExpectedThroughput=120",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --frequency2=2.4 --minExpectedThroughput=50 --maxExpectedThroughput=140",
|
||||
"wifi-eht-network --simulationTime=0.3s --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --frequency2=2.4 --minExpectedThroughput=50 --maxExpectedThroughput=140",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-eht-network --simulationTime=0.2 --udp=0 --downlink=0 --useRts=0 --nStations=4 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mpduBufferSize=1024 --mcs=7 --muSchedAccessReqInterval=45ms --frequency2=6 --minExpectedThroughput=70 --maxExpectedThroughput=550",
|
||||
"wifi-eht-network --simulationTime=0.2s --udp=0 --downlink=0 --useRts=0 --nStations=4 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mpduBufferSize=1024 --mcs=7 --muSchedAccessReqInterval=45ms --frequency2=6 --minExpectedThroughput=70 --maxExpectedThroughput=550",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60",
|
||||
"wifi-simple-ht-hidden-stations --simulationTime=1s --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58",
|
||||
"wifi-simple-ht-hidden-stations --simulationTime=1s --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"),
|
||||
("wifi-txop-aggregation --simulationTime=1 --verifyResults=1", "True", "True"),
|
||||
("wifi-80211e-txop --simulationTime=1 --verifyResults=1", "True", "True"),
|
||||
("wifi-mixed-network --simulationTime=1s", "True", "True"),
|
||||
("wifi-aggregation --simulationTime=1s --verifyResults=1", "True", "True"),
|
||||
("wifi-txop-aggregation --simulationTime=1s --verifyResults=1", "True", "True"),
|
||||
("wifi-80211e-txop --simulationTime=1s --verifyResults=1", "True", "True"),
|
||||
(
|
||||
"wifi-multi-tos --simulationTime=1 --nWifi=16 --useRts=1 --useShortGuardInterval=1",
|
||||
"wifi-multi-tos --simulationTime=1s --nWifi=16 --useRts=1 --useShortGuardInterval=1",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
@@ -214,38 +214,38 @@ cpp_examples = [
|
||||
("wifi-hidden-terminal --wifiManager=Rraa", "True", "True"),
|
||||
("wifi-hidden-terminal --wifiManager=Rrpaa", "True", "True"),
|
||||
(
|
||||
"wifi-spectrum-per-example --distance=52 --index=3 --wifiType=ns3::SpectrumWifiPhy --simulationTime=1",
|
||||
"wifi-spectrum-per-example --distance=52 --index=3 --wifiType=ns3::SpectrumWifiPhy --simulationTime=1s",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-spectrum-per-example --distance=24 --index=31 --wifiType=ns3::YansWifiPhy --simulationTime=1",
|
||||
"wifi-spectrum-per-example --distance=24 --index=31 --wifiType=ns3::YansWifiPhy --simulationTime=1s",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-spectrum-per-interference --distance=24 --index=31 --simulationTime=1 --waveformPower=0.1",
|
||||
"wifi-spectrum-per-interference --distance=24 --index=31 --simulationTime=1s --waveformPower=0.1",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
("wifi-spectrum-saturation-example --simulationTime=1 --index=63", "True", "True"),
|
||||
("wifi-spectrum-saturation-example --simulationTime=1s --index=63", "True", "True"),
|
||||
(
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --simulationTime=1",
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --simulationTime=1s",
|
||||
"True",
|
||||
"True",
|
||||
),
|
||||
(
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --apRaa=Ideal --staRaa=Ideal --simulationTime=1",
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --apRaa=Ideal --staRaa=Ideal --simulationTime=1s",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --simulationTime=1",
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --simulationTime=1s",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
(
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --apRaa=Ideal --staRaa=Ideal --simulationTime=1",
|
||||
"wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --apRaa=Ideal --staRaa=Ideal --simulationTime=1s",
|
||||
"True",
|
||||
"False",
|
||||
),
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
//
|
||||
// The user can select the distance between the stations and the APs, can enable/disable the RTS/CTS
|
||||
// mechanism and can choose the payload size and the simulation duration. Example: ./ns3 run
|
||||
// "wifi-80211e-txop --distance=10 --simulationTime=20 --payloadSize=1000"
|
||||
// "wifi-80211e-txop --distance=10 --simulationTime=20s --payloadSize=1000"
|
||||
//
|
||||
// The output prints the throughput measured for the 4 cases/networks described above. When TXOP is
|
||||
// enabled, results show increased throughput since the channel is granted for a longer duration.
|
||||
@@ -94,16 +94,16 @@ TxopDurationTracer::Trace(Time startTime, Time duration, uint8_t linkId)
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t payloadSize = 1472; // bytes
|
||||
double simulationTime = 10; // seconds
|
||||
double distance = 5; // meters
|
||||
bool enablePcap = false;
|
||||
bool verifyResults = false; // used for regression
|
||||
Time txopLimit = MicroSeconds(4096);
|
||||
uint32_t payloadSize{1472}; // bytes
|
||||
Time simulationTime{"10s"};
|
||||
double distance{5}; // meters
|
||||
bool enablePcap{false};
|
||||
bool verifyResults{false}; // used for regression
|
||||
Time txopLimit{"4096us"};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
@@ -296,7 +296,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper serverA(port);
|
||||
ApplicationContainer serverAppA = serverA.Install(wifiApNodes.Get(0));
|
||||
serverAppA.Start(Seconds(0.0));
|
||||
serverAppA.Stop(Seconds(simulationTime + 1));
|
||||
serverAppA.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
InetSocketAddress destA(ApInterfaceA.GetAddress(0), port);
|
||||
|
||||
@@ -309,12 +309,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppA = clientA.Install(wifiStaNodes.Get(0));
|
||||
clientAppA.Start(Seconds(1.0));
|
||||
clientAppA.Stop(Seconds(simulationTime + 1));
|
||||
clientAppA.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverB(port);
|
||||
ApplicationContainer serverAppB = serverB.Install(wifiApNodes.Get(1));
|
||||
serverAppB.Start(Seconds(0.0));
|
||||
serverAppB.Stop(Seconds(simulationTime + 1));
|
||||
serverAppB.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
InetSocketAddress destB(ApInterfaceB.GetAddress(0), port);
|
||||
|
||||
@@ -327,12 +327,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppB = clientB.Install(wifiStaNodes.Get(1));
|
||||
clientAppB.Start(Seconds(1.0));
|
||||
clientAppB.Stop(Seconds(simulationTime + 1));
|
||||
clientAppB.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverC(port);
|
||||
ApplicationContainer serverAppC = serverC.Install(wifiApNodes.Get(2));
|
||||
serverAppC.Start(Seconds(0.0));
|
||||
serverAppC.Stop(Seconds(simulationTime + 1));
|
||||
serverAppC.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
InetSocketAddress destC(ApInterfaceC.GetAddress(0), port);
|
||||
|
||||
@@ -345,12 +345,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppC = clientC.Install(wifiStaNodes.Get(2));
|
||||
clientAppC.Start(Seconds(1.0));
|
||||
clientAppC.Stop(Seconds(simulationTime + 1));
|
||||
clientAppC.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverD(port);
|
||||
ApplicationContainer serverAppD = serverD.Install(wifiApNodes.Get(3));
|
||||
serverAppD.Start(Seconds(0.0));
|
||||
serverAppD.Stop(Seconds(simulationTime + 1));
|
||||
serverAppD.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
InetSocketAddress destD(ApInterfaceD.GetAddress(0), port);
|
||||
|
||||
@@ -363,7 +363,7 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppD = clientD.Install(wifiStaNodes.Get(3));
|
||||
clientAppD.Start(Seconds(1.0));
|
||||
clientAppD.Stop(Seconds(simulationTime + 1));
|
||||
clientAppD.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
if (enablePcap)
|
||||
{
|
||||
@@ -377,18 +377,18 @@ main(int argc, char* argv[])
|
||||
phy.EnablePcap("STA_D", staDeviceD.Get(0));
|
||||
}
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
/* Show results */
|
||||
uint64_t totalPacketsThroughA = DynamicCast<UdpServer>(serverAppA.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughB = DynamicCast<UdpServer>(serverAppB.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughC = DynamicCast<UdpServer>(serverAppC.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughD = DynamicCast<UdpServer>(serverAppD.Get(0))->GetReceived();
|
||||
double totalPacketsThroughA = DynamicCast<UdpServer>(serverAppA.Get(0))->GetReceived();
|
||||
double totalPacketsThroughB = DynamicCast<UdpServer>(serverAppB.Get(0))->GetReceived();
|
||||
double totalPacketsThroughC = DynamicCast<UdpServer>(serverAppC.Get(0))->GetReceived();
|
||||
double totalPacketsThroughD = DynamicCast<UdpServer>(serverAppD.Get(0))->GetReceived();
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
double throughput = totalPacketsThroughA * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
auto throughput = totalPacketsThroughA * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "AC_BE with default TXOP limit (0ms): " << '\n'
|
||||
<< " Throughput = " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 28 || throughput > 29))
|
||||
@@ -397,7 +397,7 @@ main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughB * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughB * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "AC_BE with non-default TXOP limit (4.096ms): " << '\n'
|
||||
<< " Throughput = " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 36.5 || throughput > 37))
|
||||
@@ -415,7 +415,7 @@ main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughC * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughC * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "AC_VI with default TXOP limit (4.096ms): " << '\n'
|
||||
<< " Throughput = " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 36.5 || throughput > 37.5))
|
||||
@@ -433,7 +433,7 @@ main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughD * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughD * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "AC_VI with non-default TXOP limit (0ms): " << '\n'
|
||||
<< " Throughput = " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 31.5 || throughput > 32.5))
|
||||
|
||||
@@ -71,17 +71,17 @@ main(int argc, char* argv[])
|
||||
"HtMcs24", "HtMcs25", "HtMcs26", "HtMcs27", "HtMcs28", "HtMcs29", "HtMcs30", "HtMcs31",
|
||||
};
|
||||
|
||||
bool udp = true;
|
||||
double simulationTime = 5; // seconds
|
||||
double frequency = 5.0; // whether 2.4 or 5.0 GHz
|
||||
double step = 5; // meters
|
||||
bool shortGuardInterval = false;
|
||||
bool channelBonding = false;
|
||||
bool preambleDetection = true;
|
||||
bool udp{true};
|
||||
Time simulationTime{"5s"};
|
||||
double frequency{5.0}; // whether 2.4 or 5.0 GHz
|
||||
double step{5}; // meters
|
||||
bool shortGuardInterval{false};
|
||||
bool channelBonding{false};
|
||||
bool preambleDetection{true};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("step", "Granularity of the results to be plotted in meters", step);
|
||||
cmd.AddValue("simulationTime", "Simulation time per step (in seconds)", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time per step", simulationTime);
|
||||
cmd.AddValue("channelBonding",
|
||||
"Enable/disable channel bonding (channel width = 20 MHz if false, channel width = "
|
||||
"40 MHz if true)",
|
||||
@@ -226,7 +226,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper server(port);
|
||||
serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -235,7 +235,7 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -245,7 +245,7 @@ main(int argc, char* argv[])
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
|
||||
serverApp = packetSinkHelper.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime",
|
||||
@@ -258,29 +258,29 @@ main(int argc, char* argv[])
|
||||
onoff.SetAttribute("Remote", remoteAddress);
|
||||
ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
double throughput = 0;
|
||||
if (udp)
|
||||
{
|
||||
// UDP
|
||||
uint64_t totalPacketsThrough =
|
||||
double totalPacketsThrough =
|
||||
DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
throughput =
|
||||
totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); // Mbit/s
|
||||
throughput = totalPacketsThrough * payloadSize * 8 /
|
||||
simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
}
|
||||
else
|
||||
{
|
||||
// TCP
|
||||
uint64_t totalPacketsThrough =
|
||||
double totalPacketsThrough =
|
||||
DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
throughput = totalPacketsThrough * 8 / (simulationTime * 1000000.0); // Mbit/s
|
||||
throughput = totalPacketsThrough * 8 / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
}
|
||||
dataset.Add(d, throughput);
|
||||
std::cout << throughput << " Mbit/s" << std::endl;
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
//
|
||||
// The user can select the distance between the stations and the APs and can enable/disable the
|
||||
// RTS/CTS mechanism. Example: ./ns3 run "wifi-aggregation --distance=10 --enableRts=0
|
||||
// --simulationTime=20"
|
||||
// --simulationTime=20s"
|
||||
//
|
||||
// The output prints the throughput measured for the 4 cases/networks described above. When default
|
||||
// aggregation parameters are enabled, the maximum A-MPDU size is 65 kB and the throughput is
|
||||
@@ -82,17 +82,17 @@ NS_LOG_COMPONENT_DEFINE("SimpleMpduAggregation");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t payloadSize = 1472; // bytes
|
||||
double simulationTime = 10; // seconds
|
||||
double distance = 5; // meters
|
||||
bool enableRts = false;
|
||||
bool enablePcap = false;
|
||||
bool verifyResults = false; // used for regression
|
||||
uint32_t payloadSize{1472}; // bytes
|
||||
Time simulationTime{"10s"};
|
||||
double distance{5}; // meters
|
||||
bool enableRts{false};
|
||||
bool enablePcap{false};
|
||||
bool verifyResults{false}; // used for regression
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize);
|
||||
cmd.AddValue("enableRts", "Enable or disable RTS/CTS", enableRts);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
@@ -282,7 +282,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper serverA(port);
|
||||
ApplicationContainer serverAppA = serverA.Install(wifiStaNodes.Get(0));
|
||||
serverAppA.Start(Seconds(0.0));
|
||||
serverAppA.Stop(Seconds(simulationTime + 1));
|
||||
serverAppA.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper clientA(StaInterfaceA.GetAddress(0), port);
|
||||
clientA.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -291,12 +291,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppA = clientA.Install(wifiApNodes.Get(0));
|
||||
clientAppA.Start(Seconds(1.0));
|
||||
clientAppA.Stop(Seconds(simulationTime + 1));
|
||||
clientAppA.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverB(port);
|
||||
ApplicationContainer serverAppB = serverB.Install(wifiStaNodes.Get(1));
|
||||
serverAppB.Start(Seconds(0.0));
|
||||
serverAppB.Stop(Seconds(simulationTime + 1));
|
||||
serverAppB.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper clientB(StaInterfaceB.GetAddress(0), port);
|
||||
clientB.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -305,12 +305,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppB = clientB.Install(wifiApNodes.Get(1));
|
||||
clientAppB.Start(Seconds(1.0));
|
||||
clientAppB.Stop(Seconds(simulationTime + 1));
|
||||
clientAppB.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverC(port);
|
||||
ApplicationContainer serverAppC = serverC.Install(wifiStaNodes.Get(2));
|
||||
serverAppC.Start(Seconds(0.0));
|
||||
serverAppC.Stop(Seconds(simulationTime + 1));
|
||||
serverAppC.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper clientC(StaInterfaceC.GetAddress(0), port);
|
||||
clientC.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -319,12 +319,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppC = clientC.Install(wifiApNodes.Get(2));
|
||||
clientAppC.Start(Seconds(1.0));
|
||||
clientAppC.Stop(Seconds(simulationTime + 1));
|
||||
clientAppC.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverD(port);
|
||||
ApplicationContainer serverAppD = serverD.Install(wifiStaNodes.Get(3));
|
||||
serverAppD.Start(Seconds(0.0));
|
||||
serverAppD.Stop(Seconds(simulationTime + 1));
|
||||
serverAppD.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper clientD(StaInterfaceD.GetAddress(0), port);
|
||||
clientD.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -333,7 +333,7 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppD = clientD.Install(wifiApNodes.Get(3));
|
||||
clientAppD.Start(Seconds(1.0));
|
||||
clientAppD.Stop(Seconds(simulationTime + 1));
|
||||
clientAppD.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
if (enablePcap)
|
||||
{
|
||||
@@ -347,18 +347,18 @@ main(int argc, char* argv[])
|
||||
phy.EnablePcap("STA_D", staDeviceD.Get(0));
|
||||
}
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
// Show results
|
||||
uint64_t totalPacketsThroughA = DynamicCast<UdpServer>(serverAppA.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughB = DynamicCast<UdpServer>(serverAppB.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughC = DynamicCast<UdpServer>(serverAppC.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughD = DynamicCast<UdpServer>(serverAppD.Get(0))->GetReceived();
|
||||
double totalPacketsThroughA = DynamicCast<UdpServer>(serverAppA.Get(0))->GetReceived();
|
||||
double totalPacketsThroughB = DynamicCast<UdpServer>(serverAppB.Get(0))->GetReceived();
|
||||
double totalPacketsThroughC = DynamicCast<UdpServer>(serverAppC.Get(0))->GetReceived();
|
||||
double totalPacketsThroughD = DynamicCast<UdpServer>(serverAppD.Get(0))->GetReceived();
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
double throughput = totalPacketsThroughA * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
auto throughput = totalPacketsThroughA * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "Throughput with default configuration (A-MPDU aggregation enabled, 65kB): "
|
||||
<< throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 59.0 || throughput > 60.0))
|
||||
@@ -367,7 +367,7 @@ main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughB * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughB * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "Throughput with aggregation disabled: " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 30 || throughput > 31))
|
||||
{
|
||||
@@ -375,7 +375,7 @@ main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughC * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughC * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "Throughput with A-MPDU disabled and A-MSDU enabled (8kB): " << throughput
|
||||
<< " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 51 || throughput > 52))
|
||||
@@ -384,7 +384,7 @@ main(int argc, char* argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughD * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughD * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "Throughput with A-MPDU enabled (32kB) and A-MSDU enabled (4kB): " << throughput
|
||||
<< " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 58 || throughput > 59))
|
||||
|
||||
@@ -113,17 +113,17 @@ ConvertStringToStandardAndBand(std::string version)
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t payloadSize = 1472; // bytes
|
||||
double simulationTime = 10; // seconds
|
||||
std::string apVersion = "80211a";
|
||||
std::string staVersion = "80211n_5GHZ";
|
||||
std::string apRaa = "Minstrel";
|
||||
std::string staRaa = "MinstrelHt";
|
||||
bool apHasTraffic = false;
|
||||
bool staHasTraffic = true;
|
||||
uint32_t payloadSize{1472}; // bytes
|
||||
Time simulationTime{"10s"};
|
||||
std::string apVersion{"80211a"};
|
||||
std::string staVersion{"80211n_5GHZ"};
|
||||
std::string apRaa{"Minstrel"};
|
||||
std::string staRaa{"MinstrelHt"};
|
||||
bool apHasTraffic{false};
|
||||
bool staHasTraffic{true};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("apVersion",
|
||||
"The standard version used by the AP: 80211a, 80211b, 80211g, 80211p, "
|
||||
"80211n_2_4GHZ, 80211n_5GHZ, 80211ac, 80211ax_2_4GHZ or 80211ax_5GHZ",
|
||||
@@ -204,12 +204,12 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper apServer(9);
|
||||
ApplicationContainer apServerApp = apServer.Install(wifiApNode.Get(0));
|
||||
apServerApp.Start(Seconds(0.0));
|
||||
apServerApp.Stop(Seconds(simulationTime + 1));
|
||||
apServerApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper staServer(5001);
|
||||
ApplicationContainer staServerApp = staServer.Install(wifiStaNode.Get(0));
|
||||
staServerApp.Start(Seconds(0.0));
|
||||
staServerApp.Stop(Seconds(simulationTime + 1));
|
||||
staServerApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
if (apHasTraffic)
|
||||
{
|
||||
@@ -219,7 +219,7 @@ main(int argc, char* argv[])
|
||||
apClient.SetAttribute("PacketSize", UintegerValue(payloadSize)); // bytes
|
||||
ApplicationContainer apClientApp = apClient.Install(wifiApNode.Get(0));
|
||||
apClientApp.Start(Seconds(1.0));
|
||||
apClientApp.Stop(Seconds(simulationTime + 1));
|
||||
apClientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
|
||||
if (staHasTraffic)
|
||||
@@ -230,21 +230,21 @@ main(int argc, char* argv[])
|
||||
staClient.SetAttribute("PacketSize", UintegerValue(payloadSize)); // bytes
|
||||
ApplicationContainer staClientApp = staClient.Install(wifiStaNode.Get(0));
|
||||
staClientApp.Start(Seconds(1.0));
|
||||
staClientApp.Stop(Seconds(simulationTime + 1));
|
||||
staClientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
uint64_t rxBytes;
|
||||
double rxBytes;
|
||||
double throughput;
|
||||
bool error = false;
|
||||
if (apHasTraffic)
|
||||
{
|
||||
rxBytes = payloadSize * DynamicCast<UdpServer>(staServerApp.Get(0))->GetReceived();
|
||||
throughput = (rxBytes * 8) / (simulationTime * 1000000.0); // Mbit/s
|
||||
throughput = (rxBytes * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
std::cout << "AP Throughput: " << throughput << " Mbit/s" << std::endl;
|
||||
if (throughput == 0)
|
||||
{
|
||||
@@ -254,7 +254,7 @@ main(int argc, char* argv[])
|
||||
if (staHasTraffic)
|
||||
{
|
||||
rxBytes = payloadSize * DynamicCast<UdpServer>(apServerApp.Get(0))->GetReceived();
|
||||
throughput = (rxBytes * 8) / (simulationTime * 1000000.0); // Mbit/s
|
||||
throughput = (rxBytes * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
std::cout << "STA Throughput: " << throughput << " Mbit/s" << std::endl;
|
||||
if (throughput == 0)
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ PrintIntermediateTput(std::vector<uint64_t>& rxBytes,
|
||||
const ApplicationContainer& serverApp,
|
||||
uint32_t payloadSize,
|
||||
Time tputInterval,
|
||||
double simulationTime)
|
||||
Time simulationTime)
|
||||
{
|
||||
auto newRxBytes = GetRxBytes(udp, serverApp, payloadSize);
|
||||
Time now = Simulator::Now();
|
||||
@@ -126,9 +126,9 @@ PrintIntermediateTput(std::vector<uint64_t>& rxBytes,
|
||||
|
||||
rxBytes.swap(newRxBytes);
|
||||
|
||||
if (now < Seconds(simulationTime) - NanoSeconds(1))
|
||||
if (now < (simulationTime - NanoSeconds(1)))
|
||||
{
|
||||
Simulator::Schedule(Min(tputInterval, Seconds(simulationTime) - now - NanoSeconds(1)),
|
||||
Simulator::Schedule(Min(tputInterval, simulationTime - now - NanoSeconds(1)),
|
||||
&PrintIntermediateTput,
|
||||
rxBytes,
|
||||
udp,
|
||||
@@ -153,9 +153,9 @@ main(int argc, char* argv[])
|
||||
bool switchAuxPhy{true};
|
||||
uint16_t auxPhyChWidth{20};
|
||||
bool auxPhyTxCapable{true};
|
||||
double simulationTime{10}; // seconds
|
||||
double distance{1.0}; // meters
|
||||
double frequency{5}; // whether the first link operates in the 2.4, 5 or 6 GHz
|
||||
Time simulationTime{"10s"};
|
||||
double distance{1.0}; // meters
|
||||
double frequency{5}; // whether the first link operates in the 2.4, 5 or 6 GHz
|
||||
double frequency2{0}; // whether the second link operates in the 2.4, 5 or 6 GHz (0 means no
|
||||
// second link exists)
|
||||
double frequency3{
|
||||
@@ -212,7 +212,7 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.AddValue("downlink",
|
||||
"Generate downlink flows if set to 1, uplink flows otherwise",
|
||||
@@ -503,7 +503,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += server.AssignStreams(serverNodes.get(), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
for (std::size_t i = 0; i < nStations; i++)
|
||||
@@ -516,7 +516,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += client.AssignStreams(clientNodes.Get(i), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -529,7 +529,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += packetSinkHelper.AssignStreams(serverNodes.get(), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
for (std::size_t i = 0; i < nStations; i++)
|
||||
{
|
||||
@@ -547,7 +547,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += onoff.AssignStreams(clientNodes.Get(i), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,20 +563,20 @@ main(int argc, char* argv[])
|
||||
serverApp,
|
||||
payloadSize,
|
||||
tputInterval,
|
||||
simulationTime + 1);
|
||||
simulationTime + Seconds(1.0));
|
||||
}
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
// When multiple stations are used, there are chances that association requests
|
||||
// collide and hence the throughput may be lower than expected. Therefore, we relax
|
||||
// the check that the throughput cannot decrease by introducing a scaling factor (or
|
||||
// tolerance)
|
||||
double tolerance = 0.10;
|
||||
auto tolerance = 0.10;
|
||||
cumulRxBytes = GetRxBytes(udp, serverApp, payloadSize);
|
||||
uint64_t rxBytes = std::accumulate(cumulRxBytes.cbegin(), cumulRxBytes.cend(), 0);
|
||||
double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); // Mbit/s
|
||||
auto rxBytes = std::accumulate(cumulRxBytes.cbegin(), cumulRxBytes.cend(), 0.0);
|
||||
auto throughput = (rxBytes * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ main(int argc, char* argv[])
|
||||
bool downlink{true};
|
||||
bool useRts{false};
|
||||
bool useExtendedBlockAck{false};
|
||||
double simulationTime{10}; // seconds
|
||||
double distance{1.0}; // meters
|
||||
double frequency{5}; // whether 2.4, 5 or 6 GHz
|
||||
Time simulationTime{"10s"};
|
||||
double distance{1.0}; // meters
|
||||
double frequency{5}; // whether 2.4, 5 or 6 GHz
|
||||
std::size_t nStations{1};
|
||||
std::string dlAckSeqType{"NO-OFDMA"};
|
||||
bool enableUlOfdma{false};
|
||||
@@ -95,7 +95,7 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.AddValue("downlink",
|
||||
"Generate downlink flows if set to 1, uplink flows otherwise",
|
||||
@@ -376,7 +376,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += server.AssignStreams(serverNodes.get(), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
for (std::size_t i = 0; i < nStations; i++)
|
||||
@@ -389,7 +389,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += client.AssignStreams(clientNodes.Get(i), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -402,7 +402,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += packetSinkHelper.AssignStreams(serverNodes.get(), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
for (std::size_t i = 0; i < nStations; i++)
|
||||
{
|
||||
@@ -420,21 +420,21 @@ main(int argc, char* argv[])
|
||||
streamNumber += onoff.AssignStreams(clientNodes.Get(i), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
}
|
||||
|
||||
Simulator::Schedule(Seconds(0), &Ipv4GlobalRoutingHelper::PopulateRoutingTables);
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
// When multiple stations are used, there are chances that association requests
|
||||
// collide and hence the throughput may be lower than expected. Therefore, we relax
|
||||
// the check that the throughput cannot decrease by introducing a scaling factor (or
|
||||
// tolerance)
|
||||
double tolerance = 0.10;
|
||||
uint64_t rxBytes = 0;
|
||||
auto tolerance = 0.10;
|
||||
auto rxBytes = 0.0;
|
||||
if (udp)
|
||||
{
|
||||
for (uint32_t i = 0; i < serverApp.GetN(); i++)
|
||||
@@ -450,7 +450,7 @@ main(int argc, char* argv[])
|
||||
rxBytes += DynamicCast<PacketSink>(serverApp.Get(i))->GetTotalRx();
|
||||
}
|
||||
}
|
||||
double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); // Mbit/s
|
||||
auto throughput = (rxBytes * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
@@ -64,14 +64,14 @@ NS_LOG_COMPONENT_DEFINE("ht-wifi-network");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
bool udp = true;
|
||||
bool useRts = false;
|
||||
double simulationTime = 10; // seconds
|
||||
double distance = 1.0; // meters
|
||||
double frequency = 5.0; // whether 2.4 or 5.0 GHz
|
||||
int mcs = -1; // -1 indicates an unset value
|
||||
double minExpectedThroughput = 0;
|
||||
double maxExpectedThroughput = 0;
|
||||
bool udp{true};
|
||||
bool useRts{false};
|
||||
Time simulationTime{"10s"};
|
||||
double distance{1.0}; // meters
|
||||
double frequency{5}; // whether 2.4 or 5 GHz
|
||||
int mcs{-1}; // -1 indicates an unset value
|
||||
double minExpectedThroughput{0.0};
|
||||
double maxExpectedThroughput{0.0};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("frequency",
|
||||
@@ -80,7 +80,7 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
|
||||
cmd.AddValue("mcs", "if set, limit testing to a specific MCS (0-7)", mcs);
|
||||
@@ -240,7 +240,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += server.AssignStreams(wifiStaNode.Get(0), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -251,7 +251,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += client.AssignStreams(wifiApNode.Get(0), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -264,7 +264,7 @@ main(int argc, char* argv[])
|
||||
packetSinkHelper.AssignStreams(wifiStaNode.Get(0), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime",
|
||||
@@ -280,15 +280,15 @@ main(int argc, char* argv[])
|
||||
streamNumber += onoff.AssignStreams(wifiApNode.Get(0), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
uint64_t rxBytes = 0;
|
||||
auto rxBytes = 0.0;
|
||||
if (udp)
|
||||
{
|
||||
rxBytes = payloadSize * DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
@@ -297,7 +297,7 @@ main(int argc, char* argv[])
|
||||
{
|
||||
rxBytes = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
}
|
||||
double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); // Mbit/s
|
||||
auto throughput = (rxBytes * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ struct Parameters
|
||||
bool nHasTraffic; //!< True if 802.11n stations generate traffic
|
||||
bool isUdp; //!< True to generate UDP traffic
|
||||
uint32_t payloadSize; //!< Payload size in bytes
|
||||
double simulationTime; //!< Simulation time in seconds
|
||||
Time simulationTime; //!< Simulation time
|
||||
};
|
||||
|
||||
class Experiment
|
||||
@@ -130,7 +130,7 @@ Experiment::Run(Parameters params)
|
||||
uint32_t nWifiB = params.nWifiB;
|
||||
uint32_t nWifiG = params.nWifiG;
|
||||
uint32_t nWifiN = params.nWifiN;
|
||||
double simulationTime = params.simulationTime;
|
||||
auto simulationTime = params.simulationTime;
|
||||
uint32_t payloadSize = params.payloadSize;
|
||||
|
||||
NodeContainer wifiBStaNodes;
|
||||
@@ -277,7 +277,7 @@ Experiment::Run(Parameters params)
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer serverApp = server.Install(wifiApNode);
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper client(ApInterface.GetAddress(0), port);
|
||||
client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -298,13 +298,13 @@ Experiment::Run(Parameters params)
|
||||
clientApps.Add(client.Install(wifiNStaNodes));
|
||||
}
|
||||
clientApps.Start(Seconds(1.0));
|
||||
clientApps.Stop(Seconds(simulationTime + 1));
|
||||
clientApps.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
uint64_t totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
double totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
throughput = totalPacketsThrough * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -314,7 +314,7 @@ Experiment::Run(Parameters params)
|
||||
|
||||
ApplicationContainer serverApp = packetSinkHelper.Install(wifiApNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
|
||||
@@ -339,13 +339,13 @@ Experiment::Run(Parameters params)
|
||||
clientApps.Add(onoff.Install(wifiNStaNodes));
|
||||
}
|
||||
clientApps.Start(Seconds(1.0));
|
||||
clientApps.Stop(Seconds(simulationTime + 1));
|
||||
clientApps.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
uint64_t totalPacketsThrough = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
throughput += totalPacketsThrough * 8 / (simulationTime * 1000000.0);
|
||||
double totalPacketsThrough = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
throughput += totalPacketsThrough * 8 / simulationTime.GetMicroSeconds();
|
||||
}
|
||||
Simulator::Destroy();
|
||||
return throughput;
|
||||
@@ -368,14 +368,14 @@ main(int argc, char* argv[])
|
||||
params.nWifiN = 0;
|
||||
params.nHasTraffic = false;
|
||||
params.isUdp = true;
|
||||
params.payloadSize = 1472; // bytes
|
||||
params.simulationTime = 10; // seconds
|
||||
params.payloadSize = 1472; // bytes
|
||||
params.simulationTime = Seconds(10);
|
||||
|
||||
bool verifyResults = false; // used for regression
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("payloadSize", "Payload size in bytes", params.payloadSize);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", params.simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", params.simulationTime);
|
||||
cmd.AddValue("isUdp", "UDP if set to 1, TCP otherwise", params.isUdp);
|
||||
cmd.AddValue("verifyResults",
|
||||
"Enable/disable results verification at the end of the simulation",
|
||||
|
||||
@@ -47,20 +47,20 @@ NS_LOG_COMPONENT_DEFINE("WifiMultiTos");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t nWifi = 4;
|
||||
double simulationTime = 10; // seconds
|
||||
double distance = 1.0; // meters
|
||||
uint16_t mcs = 7;
|
||||
uint8_t channelWidth = 20; // MHz
|
||||
bool useShortGuardInterval = false;
|
||||
bool useRts = false;
|
||||
uint32_t nWifi{4};
|
||||
Time simulationTime{"10s"};
|
||||
double distance{1.0}; // meters
|
||||
uint16_t mcs{7};
|
||||
uint8_t channelWidth{20}; // MHz
|
||||
bool useShortGuardInterval{false};
|
||||
bool useRts{false};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("nWifi", "Number of stations", nWifi);
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the stations and the access point",
|
||||
distance);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
|
||||
cmd.AddValue("mcs", "MCS value (0 - 7)", mcs);
|
||||
cmd.AddValue("channelWidth", "Channel width in MHz", channelWidth);
|
||||
@@ -166,21 +166,21 @@ main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
sinkApplications.Start(Seconds(0.0));
|
||||
sinkApplications.Stop(Seconds(simulationTime + 1));
|
||||
sinkApplications.Stop(simulationTime + Seconds(1.0));
|
||||
sourceApplications.Start(Seconds(1.0));
|
||||
sourceApplications.Stop(Seconds(simulationTime + 1));
|
||||
sourceApplications.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
double throughput = 0;
|
||||
for (uint32_t index = 0; index < sinkApplications.GetN(); ++index)
|
||||
{
|
||||
uint64_t totalPacketsThrough =
|
||||
double totalPacketsThrough =
|
||||
DynamicCast<PacketSink>(sinkApplications.Get(index))->GetTotalRx();
|
||||
throughput += ((totalPacketsThrough * 8) / (simulationTime * 1000000.0)); // Mbit/s
|
||||
throughput += ((totalPacketsThrough * 8) / simulationTime.GetMicroSeconds()); // Mbit/s
|
||||
}
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
@@ -171,7 +171,7 @@ class NodeStatistics
|
||||
* \param stepsSize The step size.
|
||||
* \param stepsTime Time on each step.
|
||||
*/
|
||||
void AdvancePosition(Ptr<Node> node, int stepsSize, int stepsTime);
|
||||
void AdvancePosition(Ptr<Node> node, int stepsSize, Time stepsTime);
|
||||
/**
|
||||
* \brief Get the Position of a node.
|
||||
*
|
||||
@@ -325,12 +325,12 @@ NodeStatistics::GetPosition(Ptr<Node> node)
|
||||
}
|
||||
|
||||
void
|
||||
NodeStatistics::AdvancePosition(Ptr<Node> node, int stepsSize, int stepsTime)
|
||||
NodeStatistics::AdvancePosition(Ptr<Node> node, int stepsSize, Time stepsTime)
|
||||
{
|
||||
Vector pos = GetPosition(node);
|
||||
double mbs = ((m_bytesTotal * 8.0) / (1000000 * stepsTime));
|
||||
double mbs = ((m_bytesTotal * 8.0) / stepsTime.GetMicroSeconds());
|
||||
m_bytesTotal = 0;
|
||||
double atp = m_totalEnergy / stepsTime;
|
||||
double atp = m_totalEnergy / stepsTime.GetSeconds();
|
||||
m_totalEnergy = 0;
|
||||
m_totalTime = 0;
|
||||
m_output_power.Add(pos.x, atp);
|
||||
@@ -339,7 +339,7 @@ NodeStatistics::AdvancePosition(Ptr<Node> node, int stepsSize, int stepsTime)
|
||||
SetPosition(node, pos);
|
||||
NS_LOG_INFO("At time " << Simulator::Now().GetSeconds() << " sec; setting new position to "
|
||||
<< pos);
|
||||
Simulator::Schedule(Seconds(stepsTime),
|
||||
Simulator::Schedule(stepsTime,
|
||||
&NodeStatistics::AdvancePosition,
|
||||
this,
|
||||
node,
|
||||
@@ -392,20 +392,20 @@ RateCallback(std::string path, DataRate oldRate, DataRate newRate, Mac48Address
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
double maxPower = 17;
|
||||
double minPower = 0;
|
||||
uint32_t powerLevels = 18;
|
||||
double maxPower{17};
|
||||
double minPower{0};
|
||||
uint32_t powerLevels{18};
|
||||
|
||||
uint32_t rtsThreshold = 2346;
|
||||
std::string manager = "ns3::ParfWifiManager";
|
||||
std::string outputFileName = "parf";
|
||||
int ap1_x = 0;
|
||||
int ap1_y = 0;
|
||||
int sta1_x = 5;
|
||||
int sta1_y = 0;
|
||||
uint32_t steps = 200;
|
||||
uint32_t stepsSize = 1;
|
||||
uint32_t stepsTime = 1;
|
||||
uint32_t rtsThreshold{2346};
|
||||
std::string manager{"ns3::ParfWifiManager"};
|
||||
std::string outputFileName{"parf"};
|
||||
int ap1_x{0};
|
||||
int ap1_y{0};
|
||||
int sta1_x{5};
|
||||
int sta1_y{0};
|
||||
uint32_t steps{200};
|
||||
uint32_t stepsSize{1};
|
||||
Time stepsTime{"1s"};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("manager", "PRC Manager", manager);
|
||||
@@ -431,7 +431,7 @@ main(int argc, char* argv[])
|
||||
std::cout << "Exiting without running simulation; steps value of 0" << std::endl;
|
||||
}
|
||||
|
||||
uint32_t simuTime = (steps + 1) * stepsTime;
|
||||
Time simuTime = (steps + 1) * stepsTime;
|
||||
|
||||
// Define the APs
|
||||
NodeContainer wifiApNodes;
|
||||
@@ -498,7 +498,7 @@ main(int argc, char* argv[])
|
||||
NodeStatistics statistics = NodeStatistics(wifiApDevices, wifiStaDevices);
|
||||
|
||||
// Move the STA by stepsSize meters every stepsTime seconds
|
||||
Simulator::Schedule(Seconds(0.5 + stepsTime),
|
||||
Simulator::Schedule(Seconds(0.5) + stepsTime,
|
||||
&NodeStatistics::AdvancePosition,
|
||||
&statistics,
|
||||
wifiStaNodes.Get(0),
|
||||
@@ -522,11 +522,11 @@ main(int argc, char* argv[])
|
||||
OnOffHelper onoff("ns3::UdpSocketFactory", InetSocketAddress(sinkAddress, port));
|
||||
onoff.SetConstantRate(DataRate("54Mb/s"), packetSize);
|
||||
onoff.SetAttribute("StartTime", TimeValue(Seconds(0.5)));
|
||||
onoff.SetAttribute("StopTime", TimeValue(Seconds(simuTime)));
|
||||
onoff.SetAttribute("StopTime", TimeValue(simuTime));
|
||||
ApplicationContainer apps_source = onoff.Install(wifiApNodes.Get(0));
|
||||
|
||||
apps_sink.Start(Seconds(0.5));
|
||||
apps_sink.Stop(Seconds(simuTime));
|
||||
apps_sink.Stop(simuTime);
|
||||
|
||||
//------------------------------------------------------------
|
||||
//-- Setup stats and data collection
|
||||
@@ -555,7 +555,7 @@ main(int argc, char* argv[])
|
||||
manager + "/RateChange",
|
||||
MakeCallback(RateCallback));
|
||||
|
||||
Simulator::Stop(Seconds(simuTime));
|
||||
Simulator::Stop(simuTime);
|
||||
Simulator::Run();
|
||||
|
||||
std::ofstream outfile("throughput-" + outputFileName + ".plt");
|
||||
|
||||
@@ -456,22 +456,22 @@ main(int argc, char* argv[])
|
||||
{
|
||||
// LogComponentEnable("ConstantRateWifiManager", LOG_LEVEL_FUNCTION);
|
||||
|
||||
double maxPower = 17;
|
||||
double minPower = 0;
|
||||
uint32_t powerLevels = 18;
|
||||
double maxPower{17};
|
||||
double minPower{0};
|
||||
uint32_t powerLevels{18};
|
||||
|
||||
uint32_t rtsThreshold = 2346;
|
||||
std::string manager = "ns3::ParfWifiManager";
|
||||
std::string outputFileName = "parf";
|
||||
int ap1_x = 0;
|
||||
int ap1_y = 0;
|
||||
int sta1_x = 10;
|
||||
int sta1_y = 0;
|
||||
int ap2_x = 200;
|
||||
int ap2_y = 0;
|
||||
int sta2_x = 180;
|
||||
int sta2_y = 0;
|
||||
uint32_t simuTime = 100;
|
||||
uint32_t rtsThreshold{2346};
|
||||
std::string manager{"ns3::ParfWifiManager"};
|
||||
std::string outputFileName{"parf"};
|
||||
int ap1_x{0};
|
||||
int ap1_y{0};
|
||||
int sta1_x{10};
|
||||
int sta1_y{0};
|
||||
int ap2_x{200};
|
||||
int ap2_y{0};
|
||||
int sta2_x{180};
|
||||
int sta2_y{0};
|
||||
Time simuTime{"100s"};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("manager", "PRC Manager", manager);
|
||||
@@ -603,7 +603,7 @@ main(int argc, char* argv[])
|
||||
apps_source.Add(onoff1.Install(wifiApNodes.Get(1)));
|
||||
|
||||
apps_sink.Start(Seconds(0.5));
|
||||
apps_sink.Stop(Seconds(simuTime));
|
||||
apps_sink.Stop(simuTime);
|
||||
|
||||
//------------------------------------------------------------
|
||||
//-- Setup stats and data collection
|
||||
@@ -662,7 +662,7 @@ main(int argc, char* argv[])
|
||||
FlowMonitorHelper flowmon;
|
||||
Ptr<FlowMonitor> monitor = flowmon.InstallAll();
|
||||
|
||||
Simulator::Stop(Seconds(simuTime));
|
||||
Simulator::Stop(simuTime);
|
||||
Simulator::Run();
|
||||
|
||||
Ptr<Ipv4FlowClassifier> classifier = DynamicCast<Ipv4FlowClassifier>(flowmon.GetClassifier());
|
||||
@@ -686,7 +686,7 @@ main(int argc, char* argv[])
|
||||
<< "\n");
|
||||
NS_LOG_INFO(" Mean jitter: "
|
||||
<< i->second.jitterSum.GetSeconds() / (i->second.rxPackets - 1) << "\n");
|
||||
NS_LOG_INFO(" Tx Opp: " << 1 - (statisticsAp0.GetBusyTime() / simuTime));
|
||||
NS_LOG_INFO(" Tx Opp: " << 1 - (statisticsAp0.GetBusyTime() / simuTime.GetSeconds()));
|
||||
}
|
||||
if (t.sourceAddress == "10.1.1.4" && t.destinationAddress == "10.1.1.2")
|
||||
{
|
||||
@@ -704,7 +704,7 @@ main(int argc, char* argv[])
|
||||
<< "\n");
|
||||
NS_LOG_INFO(" Mean jitter: "
|
||||
<< i->second.jitterSum.GetSeconds() / (i->second.rxPackets - 1) << "\n");
|
||||
NS_LOG_INFO(" Tx Opp: " << 1 - (statisticsAp1.GetBusyTime() / simuTime));
|
||||
NS_LOG_INFO(" Tx Opp: " << 1 - (statisticsAp1.GetBusyTime() / simuTime.GetSeconds()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,21 +185,21 @@ RateCallback(uint64_t oldRate, uint64_t newRate)
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t rtsThreshold = 65535;
|
||||
std::string staManager = "ns3::MinstrelHtWifiManager";
|
||||
std::string apManager = "ns3::MinstrelHtWifiManager";
|
||||
std::string standard = "802.11n-5GHz";
|
||||
std::string outputFileName = "minstrelHT";
|
||||
uint32_t BeMaxAmpduSize = 65535;
|
||||
bool shortGuardInterval = false;
|
||||
uint32_t chWidth = 20;
|
||||
int ap1_x = 0;
|
||||
int ap1_y = 0;
|
||||
int sta1_x = 5;
|
||||
int sta1_y = 0;
|
||||
int steps = 100;
|
||||
int stepsSize = 1;
|
||||
int stepsTime = 1;
|
||||
uint32_t rtsThreshold{65535};
|
||||
std::string staManager{"ns3::MinstrelHtWifiManager"};
|
||||
std::string apManager{"ns3::MinstrelHtWifiManager"};
|
||||
std::string standard{"802.11n-5GHz"};
|
||||
std::string outputFileName{"minstrelHT"};
|
||||
uint32_t BeMaxAmpduSize{65535};
|
||||
bool shortGuardInterval{false};
|
||||
uint32_t chWidth{20};
|
||||
int ap1_x{0};
|
||||
int ap1_y{0};
|
||||
int sta1_x{5};
|
||||
int sta1_y{0};
|
||||
int steps{100};
|
||||
int stepsSize{1};
|
||||
int stepsTime{1};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("staManager", "Rate adaptation manager of the STA", staManager);
|
||||
|
||||
@@ -149,31 +149,29 @@ GenerateTraffic(Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pk
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
std::string phyMode("DsssRate1Mbps");
|
||||
double distance = 100; // m
|
||||
uint32_t packetSize = 1000; // bytes
|
||||
uint32_t numPackets = 1;
|
||||
uint32_t numNodes = 25; // by default, 5x5
|
||||
uint32_t sinkNode = 0;
|
||||
uint32_t sourceNode = 24;
|
||||
double interval = 1.0; // seconds
|
||||
bool verbose = false;
|
||||
bool tracing = false;
|
||||
std::string phyMode{"DsssRate1Mbps"};
|
||||
double distance{100}; // m
|
||||
uint32_t packetSize{1000}; // bytes
|
||||
uint32_t numPackets{1};
|
||||
uint32_t numNodes{25}; // by default, 5x5
|
||||
uint32_t sinkNode{0};
|
||||
uint32_t sourceNode{24};
|
||||
Time interPacketInterval{"1s"};
|
||||
bool verbose{false};
|
||||
bool tracing{false};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("phyMode", "Wifi Phy mode", phyMode);
|
||||
cmd.AddValue("distance", "distance (m)", distance);
|
||||
cmd.AddValue("packetSize", "size of application packet sent", packetSize);
|
||||
cmd.AddValue("numPackets", "number of packets generated", numPackets);
|
||||
cmd.AddValue("interval", "interval (seconds) between packets", interval);
|
||||
cmd.AddValue("interval", "interval (seconds) between packets", interPacketInterval);
|
||||
cmd.AddValue("verbose", "turn on all WifiNetDevice log components", verbose);
|
||||
cmd.AddValue("tracing", "turn on ascii and pcap tracing", tracing);
|
||||
cmd.AddValue("numNodes", "number of nodes", numNodes);
|
||||
cmd.AddValue("sinkNode", "Receiver node number", sinkNode);
|
||||
cmd.AddValue("sourceNode", "Sender node number", sourceNode);
|
||||
cmd.Parse(argc, argv);
|
||||
// Convert to time object
|
||||
Time interPacketInterval = Seconds(interval);
|
||||
|
||||
// Fix non-unicast data rate to be the same as that of unicast
|
||||
Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue(phyMode));
|
||||
|
||||
@@ -110,22 +110,20 @@ int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
std::string phyMode("DsssRate1Mbps");
|
||||
double rss = -80; // -dBm
|
||||
uint32_t packetSize = 1000; // bytes
|
||||
uint32_t numPackets = 1;
|
||||
double interval = 1.0; // seconds
|
||||
bool verbose = false;
|
||||
double rss{-80}; // -dBm
|
||||
uint32_t packetSize{1000}; // bytes
|
||||
uint32_t numPackets{1};
|
||||
Time interPacketInterval{"1s"};
|
||||
bool verbose{false};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("phyMode", "Wifi Phy mode", phyMode);
|
||||
cmd.AddValue("rss", "received signal strength", rss);
|
||||
cmd.AddValue("packetSize", "size of application packet sent", packetSize);
|
||||
cmd.AddValue("numPackets", "number of packets generated", numPackets);
|
||||
cmd.AddValue("interval", "interval (seconds) between packets", interval);
|
||||
cmd.AddValue("interval", "interval between packets", interPacketInterval);
|
||||
cmd.AddValue("verbose", "turn on all WifiNetDevice log components", verbose);
|
||||
cmd.Parse(argc, argv);
|
||||
// Convert to time object
|
||||
Time interPacketInterval = Seconds(interval);
|
||||
|
||||
// Fix non-unicast data rate to be the same as that of unicast
|
||||
Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue(phyMode));
|
||||
|
||||
@@ -57,13 +57,13 @@ NS_LOG_COMPONENT_DEFINE("SimplesHtHiddenStations");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t payloadSize = 1472; // bytes
|
||||
double simulationTime = 10; // seconds
|
||||
uint32_t nMpdus = 1;
|
||||
uint32_t maxAmpduSize = 0;
|
||||
bool enableRts = false;
|
||||
double minExpectedThroughput = 0;
|
||||
double maxExpectedThroughput = 0;
|
||||
uint32_t payloadSize{1472}; // bytes
|
||||
Time simulationTime{"10s"};
|
||||
uint32_t nMpdus{1};
|
||||
uint32_t maxAmpduSize{0};
|
||||
bool enableRts{false};
|
||||
double minExpectedThroughput{0};
|
||||
double maxExpectedThroughput{0};
|
||||
|
||||
RngSeedManager::SetSeed(1);
|
||||
RngSeedManager::SetRun(1);
|
||||
@@ -72,7 +72,7 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("nMpdus", "Number of aggregated MPDUs", nMpdus);
|
||||
cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize);
|
||||
cmd.AddValue("enableRts", "Enable RTS/CTS", enableRts);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("minExpectedThroughput",
|
||||
"if set, simulation fails if the lowest throughput is below this value",
|
||||
minExpectedThroughput);
|
||||
@@ -178,7 +178,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer serverApp = server.Install(wifiApNode);
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
streamNumber += server.AssignStreams(wifiApNode, streamNumber);
|
||||
|
||||
UdpClientHelper client(ApInterface.GetAddress(0), port);
|
||||
@@ -189,7 +189,7 @@ main(int argc, char* argv[])
|
||||
// Saturated UDP traffic from stations to AP
|
||||
ApplicationContainer clientApp1 = client.Install(wifiStaNodes);
|
||||
clientApp1.Start(Seconds(1.0));
|
||||
clientApp1.Stop(Seconds(simulationTime + 1));
|
||||
clientApp1.Stop(simulationTime + Seconds(1.0));
|
||||
streamNumber += client.AssignStreams(wifiStaNodes, streamNumber);
|
||||
|
||||
phy.EnablePcap("SimpleHtHiddenStations_Ap", apDevice.Get(0));
|
||||
@@ -199,15 +199,15 @@ main(int argc, char* argv[])
|
||||
AsciiTraceHelper ascii;
|
||||
phy.EnableAsciiAll(ascii.CreateFileStream("SimpleHtHiddenStations.tr"));
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
Simulator::Run();
|
||||
|
||||
uint64_t totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
double totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
double throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
auto throughput = totalPacketsThrough * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "Throughput: " << throughput << " Mbit/s" << '\n';
|
||||
if (throughput < minExpectedThroughput ||
|
||||
(maxExpectedThroughput > 0 && throughput > maxExpectedThroughput))
|
||||
|
||||
@@ -142,12 +142,12 @@ GenerateTraffic(Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pk
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
std::string phyMode("DsssRate1Mbps");
|
||||
double rss = -80; // -dBm
|
||||
uint32_t packetSize = 1000; // bytes
|
||||
uint32_t numPackets = 1;
|
||||
Time interval = Seconds(1.0);
|
||||
bool verbose = false;
|
||||
std::string phyMode{"DsssRate1Mbps"};
|
||||
double rss{-80}; // -dBm
|
||||
uint32_t packetSize{1000}; // bytes
|
||||
uint32_t numPackets{1};
|
||||
Time interval{"1s"};
|
||||
bool verbose{false};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("phyMode", "Wifi Phy mode", phyMode);
|
||||
|
||||
@@ -160,22 +160,22 @@ GenerateTraffic(Ptr<Socket> socket, uint32_t pktSize, uint32_t pktCount, Time pk
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
std::string phyMode("DsssRate1Mbps");
|
||||
double Prss = -80; // -dBm
|
||||
double Irss = -95; // -dBm
|
||||
double delta = 0; // microseconds
|
||||
uint32_t PpacketSize = 1000; // bytes
|
||||
uint32_t IpacketSize = 1000; // bytes
|
||||
bool verbose = false;
|
||||
std::string phyMode{"DsssRate1Mbps"};
|
||||
double Prss{-80}; // -dBm
|
||||
double Irss{-95}; // -dBm
|
||||
double delta{0}; // microseconds
|
||||
uint32_t PpacketSize{1000}; // bytes
|
||||
uint32_t IpacketSize{1000}; // bytes
|
||||
bool verbose{false};
|
||||
|
||||
// these are not command line arguments for this version
|
||||
uint32_t numPackets = 1;
|
||||
double interval = 1.0; // seconds
|
||||
double startTime = 10.0; // seconds
|
||||
double distanceToRx = 100.0; // meters
|
||||
uint32_t numPackets{1};
|
||||
Time interPacketInterval{"1s"};
|
||||
Time startTime{"10s"};
|
||||
double distanceToRx{100.0}; // meters
|
||||
|
||||
double offset = 91; // This is a magic number used to set the
|
||||
// transmit power, based on other configuration
|
||||
double offset{91}; // This is a magic number used to set the
|
||||
// transmit power, based on other configuration
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("phyMode", "Wifi Phy mode", phyMode);
|
||||
cmd.AddValue("Prss", "Intended primary received signal strength (dBm)", Prss);
|
||||
@@ -185,8 +185,6 @@ main(int argc, char* argv[])
|
||||
cmd.AddValue("IpacketSize", "size of interfering packet sent", IpacketSize);
|
||||
cmd.AddValue("verbose", "turn on all WifiNetDevice log components", verbose);
|
||||
cmd.Parse(argc, argv);
|
||||
// Convert to time object
|
||||
Time interPacketInterval = Seconds(interval);
|
||||
|
||||
// Fix non-unicast data rate to be the same as that of unicast
|
||||
Config::SetDefault("ns3::WifiRemoteStationManager::NonUnicastMode", StringValue(phyMode));
|
||||
@@ -269,7 +267,7 @@ main(int argc, char* argv[])
|
||||
<< " dBm at time offset=" << delta << " ms");
|
||||
|
||||
Simulator::ScheduleWithContext(source->GetNode()->GetId(),
|
||||
Seconds(startTime),
|
||||
startTime,
|
||||
&GenerateTraffic,
|
||||
source,
|
||||
PpacketSize,
|
||||
@@ -277,7 +275,7 @@ main(int argc, char* argv[])
|
||||
interPacketInterval);
|
||||
|
||||
Simulator::ScheduleWithContext(interferer->GetNode()->GetId(),
|
||||
Seconds(startTime + delta / 1000000.0),
|
||||
startTime + Seconds(delta / 1000000.0),
|
||||
&GenerateTraffic,
|
||||
interferer,
|
||||
IpacketSize,
|
||||
|
||||
@@ -109,23 +109,23 @@ PhyStateTrace(std::string context, Time start, Time duration, WifiPhyState state
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
std::string dataRate = "1Mbps";
|
||||
uint32_t packetSize = 1000; // bytes
|
||||
double duration = 10.0; // seconds
|
||||
double initialEnergy = 7.5; // joule
|
||||
double voltage = 3.0; // volts
|
||||
double txPowerStart = 0.0; // dbm
|
||||
double txPowerEnd = 15.0; // dbm
|
||||
uint32_t nTxPowerLevels = 16;
|
||||
uint32_t txPowerLevel = 0;
|
||||
double idleCurrent = 0.273; // Ampere
|
||||
double txCurrent = 0.380; // Ampere
|
||||
bool verbose = false;
|
||||
std::string dataRate{"1Mbps"};
|
||||
uint32_t packetSize{1000}; // bytes
|
||||
Time duration{"10s"};
|
||||
double initialEnergy{7.5}; // joule
|
||||
double voltage{3.0}; // volts
|
||||
double txPowerStart{0.0}; // dbm
|
||||
double txPowerEnd{15.0}; // dbm
|
||||
uint32_t nTxPowerLevels{16};
|
||||
uint32_t txPowerLevel{0};
|
||||
double idleCurrent{0.273}; // Ampere
|
||||
double txCurrent{0.380}; // Ampere
|
||||
bool verbose{false};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("dataRate", "Data rate", dataRate);
|
||||
cmd.AddValue("packetSize", "size of application packet sent", packetSize);
|
||||
cmd.AddValue("duration", "duration (seconds) of the experiment", duration);
|
||||
cmd.AddValue("duration", "duration of the experiment", duration);
|
||||
cmd.AddValue("initialEnergy", "Initial Energy (Joule) of each node", initialEnergy);
|
||||
cmd.AddValue("voltage", "Supply voltage (Joule)", voltage);
|
||||
cmd.AddValue("txPowerStart", "Minimum available transmission level (dbm)", txPowerStart);
|
||||
@@ -196,13 +196,13 @@ main(int argc, char* argv[])
|
||||
apps = onOff.Install(c.Get(0));
|
||||
|
||||
apps.Start(Seconds(0.01));
|
||||
apps.Stop(Seconds(duration));
|
||||
apps.Stop(duration);
|
||||
|
||||
// Create a packet sink to receive these packets
|
||||
PacketSinkHelper sink(transportProto, InetSocketAddress(Ipv4Address::GetAny(), 9001));
|
||||
apps = sink.Install(c.Get(1));
|
||||
apps.Start(Seconds(0.01));
|
||||
apps.Stop(Seconds(duration));
|
||||
apps.Stop(duration);
|
||||
|
||||
// Energy sources
|
||||
EnergySourceContainer eSources;
|
||||
@@ -255,7 +255,7 @@ main(int argc, char* argv[])
|
||||
Config::Connect("/NodeList/0/DeviceList/*/Phy/State/State", MakeCallback(&PhyStateTrace<0>));
|
||||
Config::Connect("/NodeList/1/DeviceList/*/Phy/State/State", MakeCallback(&PhyStateTrace<1>));
|
||||
|
||||
Simulator::Stop(Seconds(duration + 1));
|
||||
Simulator::Stop(duration + Seconds(1.0));
|
||||
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
// thus increasing the amount of generated traffic by setting the
|
||||
// interval argument to a lower value is necessary to see the
|
||||
// benefits of spatial reuse in this scenario. This can, for
|
||||
// instance, be accomplished by setting --interval=0.0001.
|
||||
// instance, be accomplished by setting --interval=100us.
|
||||
//
|
||||
// Spatial reuse reset events are traced in two text files:
|
||||
// - wifi-spatial-reuse-resets-bss-1.txt (for STA 1)
|
||||
@@ -156,29 +156,29 @@ ResetTrace(std::string context,
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
double duration = 10.0; // seconds
|
||||
double d1 = 30.0; // meters
|
||||
double d2 = 30.0; // meters
|
||||
double d3 = 150.0; // meters
|
||||
double powSta1 = 10.0; // dBm
|
||||
double powSta2 = 10.0; // dBm
|
||||
double powAp1 = 21.0; // dBm
|
||||
double powAp2 = 21.0; // dBm
|
||||
double ccaEdTrSta1 = -62; // dBm
|
||||
double ccaEdTrSta2 = -62; // dBm
|
||||
double ccaEdTrAp1 = -62; // dBm
|
||||
double ccaEdTrAp2 = -62; // dBm
|
||||
double minimumRssi = -82; // dBm
|
||||
int channelWidth = 20; // MHz
|
||||
uint32_t payloadSize = 1500; // bytes
|
||||
uint32_t mcs = 0; // MCS value
|
||||
double interval = 0.001; // seconds
|
||||
bool enableObssPd = true;
|
||||
double obssPdThreshold = -72.0; // dBm
|
||||
Time duration{"10s"};
|
||||
double d1{30.0}; // meters
|
||||
double d2{30.0}; // meters
|
||||
double d3{150.0}; // meters
|
||||
double powSta1{10.0}; // dBm
|
||||
double powSta2{10.0}; // dBm
|
||||
double powAp1{21.0}; // dBm
|
||||
double powAp2{21.0}; // dBm
|
||||
double ccaEdTrSta1{-62}; // dBm
|
||||
double ccaEdTrSta2{-62}; // dBm
|
||||
double ccaEdTrAp1{-62}; // dBm
|
||||
double ccaEdTrAp2{-62}; // dBm
|
||||
double minimumRssi{-82}; // dBm
|
||||
int channelWidth{20}; // MHz
|
||||
uint32_t payloadSize{1500}; // bytes
|
||||
uint32_t mcs{0}; // MCS value
|
||||
Time interval{"1ms"};
|
||||
bool enableObssPd{true};
|
||||
double obssPdThreshold{-72.0}; // dBm
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("duration", "Duration of simulation (s)", duration);
|
||||
cmd.AddValue("interval", "Inter packet interval (s)", interval);
|
||||
cmd.AddValue("duration", "Duration of simulation", duration);
|
||||
cmd.AddValue("interval", "Inter packet interval", interval);
|
||||
cmd.AddValue("enableObssPd", "Enable/disable OBSS_PD", enableObssPd);
|
||||
cmd.AddValue("d1", "Distance between STA1 and AP1 (m)", d1);
|
||||
cmd.AddValue("d2", "Distance between STA2 and AP2 (m)", d2);
|
||||
@@ -330,7 +330,7 @@ main(int argc, char* argv[])
|
||||
wifiStaNodes.Get(0)->AddApplication(client);
|
||||
client->SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
client->SetAttribute("MaxPackets", UintegerValue(0));
|
||||
client->SetAttribute("Interval", TimeValue(Seconds(interval)));
|
||||
client->SetAttribute("Interval", TimeValue(interval));
|
||||
Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer>();
|
||||
server->SetLocal(socketAddr);
|
||||
wifiApNodes.Get(0)->AddApplication(server);
|
||||
@@ -347,7 +347,7 @@ main(int argc, char* argv[])
|
||||
wifiStaNodes.Get(1)->AddApplication(client);
|
||||
client->SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
client->SetAttribute("MaxPackets", UintegerValue(0));
|
||||
client->SetAttribute("Interval", TimeValue(Seconds(interval)));
|
||||
client->SetAttribute("Interval", TimeValue(interval));
|
||||
Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer>();
|
||||
server->SetLocal(socketAddr);
|
||||
wifiApNodes.Get(1)->AddApplication(server);
|
||||
@@ -368,14 +368,14 @@ main(int argc, char* argv[])
|
||||
// Pass in the context string "2" to allow the trace to distinguish objects
|
||||
hePhyB->GetObssPdAlgorithm()->TraceConnect("Reset", "2", MakeCallback(&ResetTrace));
|
||||
|
||||
Simulator::Stop(Seconds(duration));
|
||||
Simulator::Stop(duration);
|
||||
Simulator::Run();
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
for (uint32_t i = 0; i < 2; i++)
|
||||
{
|
||||
const auto throughput = bytesReceived[2 + i] * 8.0 / 1000 / 1000 / duration;
|
||||
const auto throughput = bytesReceived[2 + i] * 8.0 / duration.GetMicroSeconds();
|
||||
std::cout << "Throughput for BSS " << i + 1 << ": " << throughput << " Mbit/s" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
// Users may vary the following command-line arguments in addition to the
|
||||
// attributes, global values, and default values typically available:
|
||||
//
|
||||
// --simulationTime: Simulation time in seconds [10]
|
||||
// --simulationTime: Simulation time [10s]
|
||||
// --udp: UDP if set to 1, TCP otherwise [true]
|
||||
// --distance: meters separation between nodes [50]
|
||||
// --index: restrict index to single value between 0 and 31 [256]
|
||||
@@ -128,17 +128,17 @@ NS_LOG_COMPONENT_DEFINE("WifiSpectrumPerExample");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
bool udp = true;
|
||||
double distance = 50;
|
||||
double simulationTime = 10; // seconds
|
||||
uint16_t index = 256;
|
||||
std::string wifiType = "ns3::SpectrumWifiPhy";
|
||||
std::string errorModelType = "ns3::NistErrorRateModel";
|
||||
bool enablePcap = false;
|
||||
const uint32_t tcpPacketSize = 1448;
|
||||
bool udp{true};
|
||||
double distance{50};
|
||||
Time simulationTime{"10s"};
|
||||
uint16_t index{256};
|
||||
std::string wifiType{"ns3::SpectrumWifiPhy"};
|
||||
std::string errorModelType{"ns3::NistErrorRateModel"};
|
||||
bool enablePcap{false};
|
||||
const uint32_t tcpPacketSize{1448};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.AddValue("distance", "meters separation between nodes", distance);
|
||||
cmd.AddValue("index", "restrict index to single value between 0 and 31", index);
|
||||
@@ -473,7 +473,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper server(port);
|
||||
serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
const auto packetInterval = payloadSize * 8.0 / (datarate * 1e6);
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -482,7 +482,7 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -492,7 +492,7 @@ main(int argc, char* argv[])
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
|
||||
serverApp = packetSinkHelper.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
|
||||
@@ -503,7 +503,7 @@ main(int argc, char* argv[])
|
||||
onoff.SetAttribute("Remote", remoteAddress);
|
||||
ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
|
||||
Config::ConnectWithoutContext("/NodeList/0/DeviceList/*/Phy/MonitorSnifferRx",
|
||||
@@ -520,24 +520,24 @@ main(int argc, char* argv[])
|
||||
g_noiseDbmAvg = 0;
|
||||
g_samples = 0;
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
double throughput = 0;
|
||||
uint64_t totalPacketsThrough = 0;
|
||||
auto throughput = 0.0;
|
||||
auto totalPacketsThrough = 0.0;
|
||||
if (udp)
|
||||
{
|
||||
// UDP
|
||||
totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
throughput =
|
||||
totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); // Mbit/s
|
||||
totalPacketsThrough * payloadSize * 8 / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
}
|
||||
else
|
||||
{
|
||||
// TCP
|
||||
uint64_t totalBytesRx = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
auto totalBytesRx = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
totalPacketsThrough = totalBytesRx / tcpPacketSize;
|
||||
throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); // Mbit/s
|
||||
throughput = totalBytesRx * 8 / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
}
|
||||
std::cout << std::setw(5) << i << std::setw(6) << (i % 8) << std::setprecision(2)
|
||||
<< std::fixed << std::setw(10) << datarate << std::setw(12) << throughput
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
// Users may vary the following command-line arguments in addition to the
|
||||
// attributes, global values, and default values typically available:
|
||||
//
|
||||
// --simulationTime: Simulation time in seconds [10]
|
||||
// --simulationTime: Simulation time [10s]
|
||||
// --udp: UDP if set to 1, TCP otherwise [true]
|
||||
// --distance: meters separation between nodes [50]
|
||||
// --index: restrict index to single value between 0 and 31 [256]
|
||||
@@ -179,18 +179,18 @@ static_SpectrumModelWifi5190MHz_initializer static_SpectrumModelWifi5190MHz_init
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
bool udp = true;
|
||||
double distance = 50;
|
||||
double simulationTime = 10; // seconds
|
||||
uint16_t index = 256;
|
||||
std::string wifiType = "ns3::SpectrumWifiPhy";
|
||||
std::string errorModelType = "ns3::NistErrorRateModel";
|
||||
bool enablePcap = false;
|
||||
const uint32_t tcpPacketSize = 1448;
|
||||
double waveformPower = 0;
|
||||
bool udp{true};
|
||||
double distance{50};
|
||||
Time simulationTime{"10s"};
|
||||
uint16_t index{256};
|
||||
std::string wifiType{"ns3::SpectrumWifiPhy"};
|
||||
std::string errorModelType{"ns3::NistErrorRateModel"};
|
||||
bool enablePcap{false};
|
||||
const uint32_t tcpPacketSize{1448};
|
||||
double waveformPower{0};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.AddValue("distance", "meters separation between nodes", distance);
|
||||
cmd.AddValue("index", "restrict index to single value between 0 and 31", index);
|
||||
@@ -530,7 +530,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper server(port);
|
||||
serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
const auto packetInterval = payloadSize * 8.0 / (datarate * 1e6);
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -539,7 +539,7 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -549,7 +549,7 @@ main(int argc, char* argv[])
|
||||
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
|
||||
serverApp = packetSinkHelper.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=1]"));
|
||||
@@ -560,7 +560,7 @@ main(int argc, char* argv[])
|
||||
onoff.SetAttribute("Remote", remoteAddress);
|
||||
ApplicationContainer clientApp = onoff.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
|
||||
// Configure waveform generator
|
||||
@@ -624,24 +624,24 @@ main(int argc, char* argv[])
|
||||
"Error: Wi-Fi nodes must be tuned to 5190 MHz to match the waveform generator");
|
||||
}
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
double throughput = 0;
|
||||
uint64_t totalPacketsThrough = 0;
|
||||
auto throughput = 0.0;
|
||||
auto totalPacketsThrough = 0.0;
|
||||
if (udp)
|
||||
{
|
||||
// UDP
|
||||
totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
throughput =
|
||||
totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); // Mbit/s
|
||||
totalPacketsThrough * payloadSize * 8 / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
}
|
||||
else
|
||||
{
|
||||
// TCP
|
||||
uint64_t totalBytesRx = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
auto totalBytesRx = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
totalPacketsThrough = totalBytesRx / tcpPacketSize;
|
||||
throughput = totalBytesRx * 8 / (simulationTime * 1000000.0); // Mbit/s
|
||||
throughput = totalBytesRx * 8 / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
}
|
||||
std::cout << std::setw(5) << i << std::setw(6) << (i % 8) << std::setprecision(2)
|
||||
<< std::fixed << std::setw(10) << datarate << std::setw(12) << throughput
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
// Users may vary the following command-line arguments in addition to the
|
||||
// attributes, global values, and default values typically available:
|
||||
//
|
||||
// --simulationTime: Simulation time in seconds [10]
|
||||
// --simulationTime: Simulation time [10s]
|
||||
// --distance: meters separation between nodes [1]
|
||||
// --index: restrict index to single value between 0 and 31 [256]
|
||||
// --wifiType: select ns3::SpectrumWifiPhy or ns3::YansWifiPhy [ns3::SpectrumWifiPhy]
|
||||
@@ -100,16 +100,16 @@ NS_LOG_COMPONENT_DEFINE("WifiSpectrumSaturationExample");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
double distance = 1;
|
||||
double simulationTime = 10; // seconds
|
||||
uint16_t index = 256;
|
||||
uint32_t channelWidth = 0;
|
||||
std::string wifiType = "ns3::SpectrumWifiPhy";
|
||||
std::string errorModelType = "ns3::NistErrorRateModel";
|
||||
bool enablePcap = false;
|
||||
double distance{1};
|
||||
Time simulationTime{"10s"};
|
||||
uint16_t index{256};
|
||||
uint32_t channelWidth{0};
|
||||
std::string wifiType{"ns3::SpectrumWifiPhy"};
|
||||
std::string errorModelType{"ns3::NistErrorRateModel"};
|
||||
bool enablePcap{false};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("distance", "meters separation between nodes", distance);
|
||||
cmd.AddValue("index", "restrict index to single value between 0 and 63", index);
|
||||
cmd.AddValue("wifiType", "select ns3::SpectrumWifiPhy or ns3::YansWifiPhy", wifiType);
|
||||
@@ -644,7 +644,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
const auto packetInterval = payloadSize * 8.0 / (datarate * 1e6);
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -653,7 +653,7 @@ main(int argc, char* argv[])
|
||||
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
if (enablePcap)
|
||||
{
|
||||
@@ -663,13 +663,12 @@ main(int argc, char* argv[])
|
||||
phy.EnablePcap(ss.str(), apDevice);
|
||||
}
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
double throughput;
|
||||
uint64_t totalPacketsThrough;
|
||||
totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
throughput = totalPacketsThrough * payloadSize * 8 / (simulationTime * 1000000.0); // Mbit/s
|
||||
double totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
auto throughput =
|
||||
totalPacketsThrough * payloadSize * 8 / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
std::cout << std::setw(5) << i << std::setw(6) << (i % 8) + 8 * (i / 32) << std::setw(8)
|
||||
<< channelWidth << std::setw(10) << datarate << std::setw(12) << throughput
|
||||
<< std::setw(8) << totalPacketsThrough << std::endl;
|
||||
|
||||
@@ -72,12 +72,12 @@ CalculateThroughput()
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t payloadSize = 1472; /* Transport layer payload size in bytes. */
|
||||
std::string dataRate = "100Mbps"; /* Application layer datarate. */
|
||||
std::string tcpVariant = "TcpNewReno"; /* TCP variant type. */
|
||||
std::string phyRate = "HtMcs7"; /* Physical layer bitrate. */
|
||||
double simulationTime = 10; /* Simulation time in seconds. */
|
||||
bool pcapTracing = false; /* PCAP Tracing is enabled or not. */
|
||||
uint32_t payloadSize{1472}; /* Transport layer payload size in bytes. */
|
||||
std::string dataRate{"100Mbps"}; /* Application layer datarate. */
|
||||
std::string tcpVariant{"TcpNewReno"}; /* TCP variant type. */
|
||||
std::string phyRate{"HtMcs7"}; /* Physical layer bitrate. */
|
||||
Time simulationTime{"10s"}; /* Simulation time. */
|
||||
bool pcapTracing{false}; /* PCAP Tracing is enabled or not. */
|
||||
|
||||
/* Command line argument parser setup. */
|
||||
CommandLine cmd(__FILE__);
|
||||
@@ -194,10 +194,11 @@ main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* Start Simulation */
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
double averageThroughput = ((sink->GetTotalRx() * 8) / (1e6 * simulationTime));
|
||||
auto averageThroughput =
|
||||
(static_cast<double>(sink->GetTotalRx() * 8) / simulationTime.GetMicroSeconds());
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
@@ -57,16 +57,16 @@ NS_LOG_COMPONENT_DEFINE("wifi-timing-attributes");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t slot = 9; // slot time in microseconds
|
||||
uint32_t sifs = 10; // SIFS duration in microseconds
|
||||
uint32_t pifs = 19; // PIFS duration in microseconds
|
||||
double simulationTime = 10; // simulation time in seconds
|
||||
uint32_t slot{9}; // slot time in microseconds
|
||||
uint32_t sifs{10}; // SIFS duration in microseconds
|
||||
uint32_t pifs{19}; // PIFS duration in microseconds
|
||||
Time simulationTime{"10s"}; // Simulation time
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("slot", "Slot time in microseconds", slot);
|
||||
cmd.AddValue("sifs", "SIFS duration in microseconds", sifs);
|
||||
cmd.AddValue("pifs", "PIFS duration in microseconds", pifs);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.Parse(argc, argv);
|
||||
|
||||
// Since default reference loss is defined for 5 GHz, it needs to be changed when operating
|
||||
@@ -146,7 +146,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper server(port);
|
||||
ApplicationContainer serverApp = server.Install(wifiStaNode.Get(0));
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -155,18 +155,18 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientApp = client.Install(wifiApNode.Get(0));
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
// Populate routing table
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
// Set simulation time and launch simulation
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
// Get and print results
|
||||
uint64_t totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
double throughput = totalPacketsThrough * 1472 * 8 / (simulationTime * 1000000.0); // Mbit/s
|
||||
double totalPacketsThrough = DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
auto throughput = totalPacketsThrough * 1472 * 8 / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
std::cout << "Throughput: " << throughput << " Mbit/s" << std::endl;
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
//
|
||||
// The user can select the distance between the stations and the APs, can enable/disable the RTS/CTS
|
||||
// mechanism and can modify the duration of a TXOP. Example: ./ns3 run "wifi-txop-aggregation
|
||||
// --distance=10 --enableRts=0 --simulationTime=20"
|
||||
// --distance=10 --enableRts=0 --simulationTime=20s"
|
||||
//
|
||||
// The output prints the throughput and the maximum TXOP duration measured for the 4 cases/networks
|
||||
// described above. When default aggregation parameters are enabled, the
|
||||
@@ -108,19 +108,19 @@ TxopDurationTracer::Trace(Time startTime, Time duration, uint8_t linkId)
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
uint32_t payloadSize = 1472; // bytes
|
||||
double simulationTime = 10; // seconds
|
||||
double txopLimit = 3520; // microseconds
|
||||
double distance = 5; // meters
|
||||
bool enableRts = false;
|
||||
bool enablePcap = false;
|
||||
bool verifyResults = false; // used for regression
|
||||
uint32_t payloadSize{1472}; // bytes
|
||||
Time simulationTime{"10s"};
|
||||
double txopLimit{3520}; // microseconds
|
||||
double distance{5}; // meters
|
||||
bool enableRts{false};
|
||||
bool enablePcap{false};
|
||||
bool verifyResults{false}; // used for regression
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("payloadSize", "Payload size in bytes", payloadSize);
|
||||
cmd.AddValue("enableRts", "Enable or disable RTS/CTS", enableRts);
|
||||
cmd.AddValue("txopLimit", "TXOP duration in microseconds", txopLimit);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
@@ -351,7 +351,7 @@ main(int argc, char* argv[])
|
||||
UdpServerHelper serverA(port);
|
||||
ApplicationContainer serverAppA = serverA.Install(wifiStaNodes.Get(0));
|
||||
serverAppA.Start(Seconds(0.0));
|
||||
serverAppA.Stop(Seconds(simulationTime + 1));
|
||||
serverAppA.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper clientA(StaInterfaceA.GetAddress(0), port);
|
||||
clientA.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -360,12 +360,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppA = clientA.Install(wifiApNodes.Get(0));
|
||||
clientAppA.Start(Seconds(1.0));
|
||||
clientAppA.Stop(Seconds(simulationTime + 1));
|
||||
clientAppA.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverB(port);
|
||||
ApplicationContainer serverAppB = serverB.Install(wifiStaNodes.Get(1));
|
||||
serverAppB.Start(Seconds(0.0));
|
||||
serverAppB.Stop(Seconds(simulationTime + 1));
|
||||
serverAppB.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper clientB(StaInterfaceB.GetAddress(0), port);
|
||||
clientB.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -374,12 +374,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppB = clientB.Install(wifiApNodes.Get(1));
|
||||
clientAppB.Start(Seconds(1.0));
|
||||
clientAppB.Stop(Seconds(simulationTime + 1));
|
||||
clientAppB.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverC(port);
|
||||
ApplicationContainer serverAppC = serverC.Install(wifiStaNodes.Get(2));
|
||||
serverAppC.Start(Seconds(0.0));
|
||||
serverAppC.Stop(Seconds(simulationTime + 1));
|
||||
serverAppC.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper clientC(StaInterfaceC.GetAddress(0), port);
|
||||
clientC.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -388,12 +388,12 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppC = clientC.Install(wifiApNodes.Get(2));
|
||||
clientAppC.Start(Seconds(1.0));
|
||||
clientAppC.Stop(Seconds(simulationTime + 1));
|
||||
clientAppC.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpServerHelper serverD(port);
|
||||
ApplicationContainer serverAppD = serverD.Install(wifiStaNodes.Get(3));
|
||||
serverAppD.Start(Seconds(0.0));
|
||||
serverAppD.Stop(Seconds(simulationTime + 1));
|
||||
serverAppD.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
UdpClientHelper clientD(StaInterfaceD.GetAddress(0), port);
|
||||
clientD.SetAttribute("MaxPackets", UintegerValue(4294967295U));
|
||||
@@ -402,7 +402,7 @@ main(int argc, char* argv[])
|
||||
|
||||
ApplicationContainer clientAppD = clientD.Install(wifiApNodes.Get(3));
|
||||
clientAppD.Start(Seconds(1.0));
|
||||
clientAppD.Stop(Seconds(simulationTime + 1));
|
||||
clientAppD.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
if (enablePcap)
|
||||
{
|
||||
@@ -416,18 +416,18 @@ main(int argc, char* argv[])
|
||||
phy.EnablePcap("STA_D", staDeviceD.Get(0));
|
||||
}
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
// Show results
|
||||
uint64_t totalPacketsThroughA = DynamicCast<UdpServer>(serverAppA.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughB = DynamicCast<UdpServer>(serverAppB.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughC = DynamicCast<UdpServer>(serverAppC.Get(0))->GetReceived();
|
||||
uint64_t totalPacketsThroughD = DynamicCast<UdpServer>(serverAppD.Get(0))->GetReceived();
|
||||
double totalPacketsThroughA = DynamicCast<UdpServer>(serverAppA.Get(0))->GetReceived();
|
||||
double totalPacketsThroughB = DynamicCast<UdpServer>(serverAppB.Get(0))->GetReceived();
|
||||
double totalPacketsThroughC = DynamicCast<UdpServer>(serverAppC.Get(0))->GetReceived();
|
||||
double totalPacketsThroughD = DynamicCast<UdpServer>(serverAppD.Get(0))->GetReceived();
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
double throughput = totalPacketsThroughA * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
auto throughput = totalPacketsThroughA * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "Default configuration (A-MPDU aggregation enabled, 65kB): " << '\n'
|
||||
<< " Throughput = " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 57.5 || throughput > 58.5))
|
||||
@@ -448,7 +448,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughB * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughB * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "Aggregation disabled: " << '\n'
|
||||
<< " Throughput = " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 38 || throughput > 39))
|
||||
@@ -468,7 +468,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughC * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughC * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "A-MPDU disabled and A-MSDU enabled (8kB): " << '\n'
|
||||
<< " Throughput = " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 52 || throughput > 53))
|
||||
@@ -488,7 +488,7 @@ main(int argc, char* argv[])
|
||||
}
|
||||
}
|
||||
|
||||
throughput = totalPacketsThroughD * payloadSize * 8 / (simulationTime * 1000000.0);
|
||||
throughput = totalPacketsThroughD * payloadSize * 8 / simulationTime.GetMicroSeconds();
|
||||
std::cout << "A-MPDU enabled (32kB) and A-MSDU enabled (4kB): " << '\n'
|
||||
<< " Throughput = " << throughput << " Mbit/s" << '\n';
|
||||
if (verifyResults && (throughput < 58 || throughput > 59))
|
||||
|
||||
@@ -62,19 +62,19 @@ NS_LOG_COMPONENT_DEFINE("vht-wifi-network");
|
||||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
bool udp = true;
|
||||
bool useRts = false;
|
||||
double simulationTime = 10; // seconds
|
||||
double distance = 1.0; // meters
|
||||
int mcs = -1; // -1 indicates an unset value
|
||||
double minExpectedThroughput = 0;
|
||||
double maxExpectedThroughput = 0;
|
||||
bool udp{true};
|
||||
bool useRts{false};
|
||||
Time simulationTime{"10s"};
|
||||
double distance{1.0}; // meters
|
||||
int mcs{-1}; // -1 indicates an unset value
|
||||
double minExpectedThroughput{0.0};
|
||||
double maxExpectedThroughput{0.0};
|
||||
|
||||
CommandLine cmd(__FILE__);
|
||||
cmd.AddValue("distance",
|
||||
"Distance in meters between the station and the access point",
|
||||
distance);
|
||||
cmd.AddValue("simulationTime", "Simulation time in seconds", simulationTime);
|
||||
cmd.AddValue("simulationTime", "Simulation time", simulationTime);
|
||||
cmd.AddValue("udp", "UDP if set to 1, TCP otherwise", udp);
|
||||
cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
|
||||
cmd.AddValue("mcs", "if set, limit testing to a specific MCS (0-9)", mcs);
|
||||
@@ -222,7 +222,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += server.AssignStreams(wifiStaNode.Get(0), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
const auto packetInterval = payloadSize * 8.0 / maxLoad;
|
||||
|
||||
UdpClientHelper client(staNodeInterface.GetAddress(0), port);
|
||||
@@ -233,7 +233,7 @@ main(int argc, char* argv[])
|
||||
streamNumber += client.AssignStreams(wifiApNode.Get(0), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -246,7 +246,7 @@ main(int argc, char* argv[])
|
||||
packetSinkHelper.AssignStreams(wifiStaNode.Get(0), streamNumber);
|
||||
|
||||
serverApp.Start(Seconds(0.0));
|
||||
serverApp.Stop(Seconds(simulationTime + 1));
|
||||
serverApp.Stop(simulationTime + Seconds(1.0));
|
||||
|
||||
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
|
||||
onoff.SetAttribute("OnTime",
|
||||
@@ -262,15 +262,15 @@ main(int argc, char* argv[])
|
||||
streamNumber += onoff.AssignStreams(wifiApNode.Get(0), streamNumber);
|
||||
|
||||
clientApp.Start(Seconds(1.0));
|
||||
clientApp.Stop(Seconds(simulationTime + 1));
|
||||
clientApp.Stop(simulationTime + Seconds(1.0));
|
||||
}
|
||||
|
||||
Ipv4GlobalRoutingHelper::PopulateRoutingTables();
|
||||
|
||||
Simulator::Stop(Seconds(simulationTime + 1));
|
||||
Simulator::Stop(simulationTime + Seconds(1.0));
|
||||
Simulator::Run();
|
||||
|
||||
uint64_t rxBytes = 0;
|
||||
auto rxBytes = 0.0;
|
||||
if (udp)
|
||||
{
|
||||
rxBytes = payloadSize * DynamicCast<UdpServer>(serverApp.Get(0))->GetReceived();
|
||||
@@ -279,7 +279,7 @@ main(int argc, char* argv[])
|
||||
{
|
||||
rxBytes = DynamicCast<PacketSink>(serverApp.Get(0))->GetTotalRx();
|
||||
}
|
||||
double throughput = (rxBytes * 8) / (simulationTime * 1000000.0); // Mbit/s
|
||||
auto throughput = (rxBytes * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
|
||||
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user