#include "ns3/attribute-container.h"
#include "ns3/boolean.h"
#include "ns3/command-line.h"
#include "ns3/config.h"
#include "ns3/double.h"
#include "ns3/enum.h"
#include "ns3/he-phy.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/ipv4-global-routing-helper.h"
#include "ns3/log.h"
#include "ns3/mobility-helper.h"
#include "ns3/multi-model-spectrum-channel.h"
#include "ns3/on-off-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/packet-sink.h"
#include "ns3/spectrum-wifi-helper.h"
#include "ns3/ssid.h"
#include "ns3/string.h"
#include "ns3/udp-client-server-helper.h"
#include "ns3/udp-server.h"
#include "ns3/uinteger.h"
#include "ns3/wifi-acknowledgment.h"
#include "ns3/yans-wifi-channel.h"
#include "ns3/yans-wifi-helper.h"
#include <algorithm>
#include <functional>
// This is a simple example in order to show how to configure an IEEE 802.11ax Wi-Fi network.
//
// It outputs the UDP or TCP goodput for every HE MCS value, which depends on the MCS value (0 to
// 11), the channel width (20, 40, 80 or 160 MHz) and the guard interval (800ns, 1600ns or 3200ns).
// The PHY bitrate is constant over all the simulation run. The user can also specify the distance
// between the access point and the station: the larger the distance the smaller the goodput.
//
// The simulation assumes a configurable number of stations in an infrastructure network:
//
// STA AP
// * *
// | |
// n1 n2
//
// Packets in this simulation belong to BestEffort Access Class (AC_BE).
// By selecting an acknowledgment sequence for DL MU PPDUs, it is possible to aggregate a
// Round Robin scheduler to the AP, so that DL MU PPDUs are sent by the AP via DL OFDMA.
using namespace ns3;
NS_LOG_COMPONENT_DEFINE("he-wifi-network");
int
main(int argc, char* argv[])
{
bool udp{true};
bool downlink{true};
bool useRts{false};
bool use80Plus80{false};
bool useExtendedBlockAck{false};
Time simulationTime{"10s"};
meter_u distance{1.0};
std::size_t nStations{1};
std::string dlAckSeqType{"NO-OFDMA"};
bool enableUlOfdma{false};
bool enableBsrp{false};
std::string mcsStr;
std::vector<uint64_t> mcsValues;
int channelWidth{-1}; // in MHz, -1 indicates an unset value
int guardInterval{-1}; // in nanoseconds, -1 indicates an unset value
uint32_t payloadSize =
700; // must fit in the max TX duration when transmitting at MCS 0 over an RU of 26 tones
std::string phyModel{"Spectrum"};
double minExpectedThroughput{0.0};
double maxExpectedThroughput{0.0};
Time accessReqInterval{0};
// New parameters for multi-AP setup
uint32_t nGrid = 4; // n x n grid of APs
uint32_t staPerAp = 2; // Number of STAs per AP
double staDistance = 1.0; // Distance between STA and AP in meters
//
double apDistance = 10.0; // Distance between APs in meters
double frequency{2.4}; // whether 2.4, 5 or 6 GHz
double power = 16;
int minChannelWidth = 20;
// int maxChannelWidth = frequency == 2.4 ? 40 : 160;
int maxChannelWidth = minChannelWidth; //only one wildth is set
CommandLine cmd(__FILE__);
cmd.AddValue("frequency",
"Whether working in the 2.4, 5 or 6 GHz band (other values gets rejected)",
frequency);
cmd.AddValue("distance",
"Distance in meters between the station and the access point",
distance);
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",
downlink);
cmd.AddValue("useRts", "Enable/disable RTS/CTS", useRts);
cmd.AddValue("use80Plus80", "Enable/disable use of 80+80 MHz", use80Plus80);
cmd.AddValue("useExtendedBlockAck", "Enable/disable use of extended BACK", useExtendedBlockAck);
cmd.AddValue("nStations", "Number of non-AP HE stations", nStations);
cmd.AddValue("dlAckType",
"Ack sequence type for DL OFDMA (NO-OFDMA, ACK-SU-FORMAT, MU-BAR, AGGR-MU-BAR)",
dlAckSeqType);
cmd.AddValue("enableUlOfdma",
"Enable UL OFDMA (useful if DL OFDMA is enabled and TCP is used)",
enableUlOfdma);
cmd.AddValue("enableBsrp",
"Enable BSRP (useful if DL and UL OFDMA are enabled and TCP is used)",
enableBsrp);
cmd.AddValue(
"muSchedAccessReqInterval",
"Duration of the interval between two requests for channel access made by the MU scheduler",
accessReqInterval);
cmd.AddValue(
"mcs",
"list of comma separated MCS values to test; if unset, all MCS values (0-11) are tested",
mcsStr);
cmd.AddValue("channelWidth",
"if set, limit testing to a specific channel width expressed in MHz (20, 40, 80 "
"or 160 MHz)",
channelWidth);
cmd.AddValue("guardInterval",
"if set, limit testing to a specific guard interval duration expressed in "
"nanoseconds (800, 1600 or 3200 ns)",
guardInterval);
cmd.AddValue("payloadSize", "The application payload size in bytes", payloadSize);
cmd.AddValue("phyModel",
"PHY model to use when OFDMA is disabled (Yans or Spectrum). If 80+80 MHz or "
"OFDMA is enabled "
"then Spectrum is automatically selected",
phyModel);
cmd.AddValue("minExpectedThroughput",
"if set, simulation fails if the lowest throughput is below this value",
minExpectedThroughput);
cmd.AddValue("maxExpectedThroughput",
"if set, simulation fails if the highest throughput is above this value",
maxExpectedThroughput);
cmd.AddValue("nGrid", "Number of APs in each dimension of the grid", nGrid);
cmd.AddValue("staPerAp", "Number of STAs per AP", staPerAp);
cmd.AddValue("apDistance", "Distance between APs in meters", apDistance);
cmd.AddValue("staDistance", "Distance between STA and AP in meters", staDistance);
cmd.Parse(argc, argv);
if (useRts)
{
Config::SetDefault("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue("0"));
Config::SetDefault("ns3::WifiDefaultProtectionManager::EnableMuRts", BooleanValue(true));
}
if (dlAckSeqType == "ACK-SU-FORMAT")
{
Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
EnumValue(WifiAcknowledgment::DL_MU_BAR_BA_SEQUENCE));
}
else if (dlAckSeqType == "MU-BAR")
{
Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
EnumValue(WifiAcknowledgment::DL_MU_TF_MU_BAR));
}
else if (dlAckSeqType == "AGGR-MU-BAR")
{
Config::SetDefault("ns3::WifiDefaultAckManager::DlMuAckSequenceType",
EnumValue(WifiAcknowledgment::DL_MU_AGGREGATE_TF));
}
else if (dlAckSeqType != "NO-OFDMA")
{
NS_ABORT_MSG("Invalid DL ack sequence type (must be NO-OFDMA, ACK-SU-FORMAT, MU-BAR or "
"AGGR-MU-BAR)");
}
if (phyModel != "Yans" && phyModel != "Spectrum")
{
NS_ABORT_MSG("Invalid PHY model (must be Yans or Spectrum)");
}
if (use80Plus80 || (dlAckSeqType != "NO-OFDMA"))
{
// SpectrumWifiPhy is required for 80+80 MHz and OFDMA
phyModel = "Spectrum";
}
// double prevThroughput[12] = {0};
// double prevThroughput[12] = {0};
// std::cout << "sta num"
// << "\t\t"
// << "MCS value"
// << "\t\t"
// << "Channel width"
// << "\t\t"
// << "GI"
// << "\t\t\t"
// << "Throughput" << '\n';
uint8_t minMcs = 0;
uint8_t maxMcs = 11;
maxMcs = minMcs; // only one msc is set
if (mcsStr.empty())
{
for (uint8_t mcs = minMcs; mcs <= maxMcs; ++mcs)
{
mcsValues.push_back(mcs);
}
}
else
{
AttributeContainerValue<UintegerValue, ',', std::vector> attr;
auto checker = DynamicCast<AttributeContainerChecker>(MakeAttributeContainerChecker(attr));
checker->SetItemChecker(MakeUintegerChecker<uint8_t>());
attr.DeserializeFromString(mcsStr, checker);
mcsValues = attr.Get();
std::sort(mcsValues.begin(), mcsValues.end());
}
if ((channelWidth != -1) &&
((channelWidth < minChannelWidth) || (channelWidth > maxChannelWidth)))
{
NS_FATAL_ERROR("Invalid channel width: " << channelWidth << " MHz");
}
if (channelWidth >= minChannelWidth && channelWidth <= maxChannelWidth)
{
minChannelWidth = channelWidth;
maxChannelWidth = channelWidth;
}
int minGi = enableUlOfdma ? 1600 : 800;
int maxGi = 3200;
maxGi = minGi; // only one Gi is set
if (guardInterval >= minGi && guardInterval <= maxGi)
{
minGi = guardInterval;
maxGi = guardInterval;
}
for (const auto mcs : mcsValues)
{
uint8_t index = 0;
// double previo——taus = 0;
for (int width = minChannelWidth; width <= maxChannelWidth; width *= 2) // MHz
{
const auto is80Plus80 = (use80Plus80 && (width == 160));
const std::string widthStr = is80Plus80 ? "80+80" : std::to_string(width);
const auto segmentWidthStr = is80Plus80 ? "80" : widthStr;
int gi = 800;
for (int flag = 0; flag < 11; flag++) // Nanoseconds
{
if (!udp)
{
Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(payloadSize));
}
// Calculate number of APs and STAs
uint32_t nAp = nGrid * nGrid;
uint32_t totalSta = nAp * staPerAp;
NodeContainer wifiApNodes;
wifiApNodes.Create(nAp);
NodeContainer wifiStaNodes;
wifiStaNodes.Create(totalSta);
NetDeviceContainer apDevices;
NetDeviceContainer staDevices;
WifiMacHelper mac;
WifiHelper wifi;
std::string channelStr("{0, " + segmentWidthStr + ", ");
StringValue ctrlRate;
auto nonHtRefRateMbps = HePhy::GetNonHtReferenceRate(mcs) / 1e6;
std::ostringstream ossDataMode;
ossDataMode << "HeMcs" << mcs;
if (frequency == 6)
{
ctrlRate = StringValue(ossDataMode.str());
channelStr += "BAND_6GHZ, 0}";
Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
DoubleValue(48));
}
else if (frequency == 5)
{
std::ostringstream ossControlMode;
ossControlMode << "OfdmRate" << nonHtRefRateMbps << "Mbps";
ctrlRate = StringValue(ossControlMode.str());
channelStr += "BAND_5GHZ, 0}";
}
else if (frequency == 2.4)
{
std::ostringstream ossControlMode;
ossControlMode << "ErpOfdmRate" << nonHtRefRateMbps << "Mbps";
ctrlRate = StringValue(ossControlMode.str());
channelStr += "BAND_2_4GHZ, 0}";
Config::SetDefault("ns3::LogDistancePropagationLossModel::ReferenceLoss",
DoubleValue(40));
}
else
{
NS_FATAL_ERROR("Wrong frequency value!");
}
if (is80Plus80)
{
channelStr += std::string(";") + channelStr;
}
wifi.SetStandard(WIFI_STANDARD_80211ax);
// wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
// "DataMode",
// StringValue(ossDataMode.str()),
// "ControlMode",
// ctrlRate);
wifi.SetRemoteStationManager("ns3::ThompsonSamplingWifiManager");
// Set guard interval
wifi.ConfigHeOptions("GuardInterval", TimeValue(NanoSeconds(gi)));
// Create SSID for each AP
std::vector<Ssid> ssids;
for (uint32_t i = 0; i < nAp; ++i)
{
ssids.push_back(Ssid("ns3-80211ax-AP" + std::to_string(i)));
}
if (phyModel == "Spectrum")
{
auto spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
auto lossModel = CreateObject<LogDistancePropagationLossModel>();
spectrumChannel->AddPropagationLossModel(lossModel);
SpectrumWifiPhyHelper phy;
phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel(spectrumChannel);
// /* 设置固定的发射功率 */
phy.Set("TxPowerStart", DoubleValue(power));
phy.Set("TxPowerEnd", DoubleValue(power));
// Install AP devices
if (dlAckSeqType != "NO-OFDMA")
{
mac.SetMultiUserScheduler("ns3::RrMultiUserScheduler",
"EnableUlOfdma",
BooleanValue(enableUlOfdma),
"EnableBsrp",
BooleanValue(enableBsrp),
"AccessReqInterval",
TimeValue(accessReqInterval));
}
for (uint32_t i = 0; i < nAp; ++i)
{
mac.SetType("ns3::ApWifiMac",
"EnableBeaconJitter", BooleanValue(false),
"Ssid", SsidValue(ssids[i]));
phy.Set("ChannelSettings", StringValue(channelStr));
apDevices.Add(wifi.Install(phy, mac, wifiApNodes.Get(i)));
}
// Install STA devices
for (uint32_t i = 0; i < nAp; ++i)
{
mac.SetType("ns3::StaWifiMac",
"Ssid", SsidValue(ssids[i]),
"ActiveProbing", BooleanValue(false),
"MpduBufferSize", UintegerValue(useExtendedBlockAck ? 256 : 64));
for (uint32_t j = 0; j < staPerAp; ++j)
{
uint32_t staIndex = i * staPerAp + j;
phy.Set("ChannelSettings", StringValue(channelStr));
staDevices.Add(wifi.Install(phy, mac, wifiStaNodes.Get(staIndex)));
}
}
}
else
{
auto channel = YansWifiChannelHelper::Default();
YansWifiPhyHelper phy;
phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel(channel.Create());
// /* 设置固定的发射功率 */
phy.Set("TxPowerStart", DoubleValue(power));
phy.Set("TxPowerEnd", DoubleValue(power));
// Install AP devices
for (uint32_t i = 0; i < nAp; ++i)
{
mac.SetType("ns3::ApWifiMac",
"EnableBeaconJitter", BooleanValue(false),
"Ssid", SsidValue(ssids[i]));
phy.Set("ChannelSettings", StringValue(channelStr));
apDevices.Add(wifi.Install(phy, mac, wifiApNodes.Get(i)));
}
// Install STA devices
for (uint32_t i = 0; i < nAp; ++i)
{
mac.SetType("ns3::StaWifiMac",
"Ssid", SsidValue(ssids[i]),
"ActiveProbing", BooleanValue(false),
"MpduBufferSize", UintegerValue(useExtendedBlockAck ? 256 : 64));
for (uint32_t j = 0; j < staPerAp; ++j)
{
uint32_t staIndex = i * staPerAp + j;
phy.Set("ChannelSettings", StringValue(channelStr));
staDevices.Add(wifi.Install(phy, mac, wifiStaNodes.Get(staIndex)));
}
}
}
int64_t streamNumber = 150;
streamNumber += WifiHelper::AssignStreams(apDevices, streamNumber);
streamNumber += WifiHelper::AssignStreams(staDevices, streamNumber);
// Mobility - APs in grid formation
MobilityHelper apMobility;
apMobility.SetPositionAllocator("ns3::GridPositionAllocator",
"MinX", DoubleValue(0.0),
"MinY", DoubleValue(0.0),
"DeltaX", DoubleValue(apDistance),
"DeltaY", DoubleValue(apDistance),
"GridWidth", UintegerValue(nGrid),
"LayoutType", StringValue("RowFirst"));
apMobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
apMobility.Install(wifiApNodes);
// Mobility - STAs around their APs
MobilityHelper staMobility;
Ptr<ListPositionAllocator> staPositionAlloc = CreateObject<ListPositionAllocator>();
for (uint32_t i = 0; i < nAp; ++i)
{
Ptr<Node> apNode = wifiApNodes.Get(i);
Ptr<MobilityModel> apMobilityModel = apNode->GetObject<MobilityModel>();
Vector apPosition = apMobilityModel->GetPosition();
for (uint32_t j = 0; j < staPerAp; ++j)
{
// uint32_t staIndex = i * staPerAp + j;
// Place STAs in a circle around their AP
double angle = 2 * M_PI * (j / static_cast<double>(staPerAp));
double x = apPosition.x + staDistance * cos(angle);
double y = apPosition.y + staDistance * sin(angle);
// double x = apPosition.x;
// double y = apPosition.y;
double z = 5;
// printf("%f\t%f\t%f\n",x,y,z);
staPositionAlloc->Add(Vector(x, y, z));
}
}
staMobility.SetPositionAllocator(staPositionAlloc);
staMobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
staMobility.Install(wifiStaNodes);
/* Internet stack*/
InternetStackHelper stack;
stack.Install(wifiApNodes);
stack.Install(wifiStaNodes);
streamNumber += stack.AssignStreams(wifiApNodes, streamNumber);
streamNumber += stack.AssignStreams(wifiStaNodes, streamNumber);
Ipv4AddressHelper address;
address.SetBase("192.168.1.0", "255.255.255.0");
Ipv4InterfaceContainer apInterfaces;
Ipv4InterfaceContainer staInterfaces;
apInterfaces = address.Assign(apDevices);
staInterfaces = address.Assign(staDevices);
/* Setting applications */
ApplicationContainer serverApps;
ApplicationContainer clientApps;
// const auto maxLoad =
// totalSta*HePhy::GetDataRate(mcs, MHz_u{static_cast<double>(width)}, NanoSeconds(gi), 1) /
// totalSta;
const auto maxLoad = 1000000000; /* 1000 Mb/s*/
if (udp)
{
// UDP flow
uint16_t port = 9;
// Install servers on APs or STAs based on downlink direction
if (downlink)
{
// Downlink: servers on STAs, clients on APs
for (uint32_t i = 0; i < totalSta; ++i)
{
UdpServerHelper server(port);
serverApps.Add(server.Install(wifiStaNodes.Get(i)));
}
for (uint32_t i = 0; i < nAp; ++i)
{
for (uint32_t j = 0; j < staPerAp; ++j)
{
uint32_t staIndex = i * staPerAp + j;
UdpClientHelper client(staInterfaces.GetAddress(staIndex), port);
client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
client.SetAttribute("Interval", TimeValue(Seconds(payloadSize * 8.0 / maxLoad)));
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
clientApps.Add(client.Install(wifiApNodes.Get(i)));
}
}
}
else
{
// Uplink: servers on APs, clients on STAs
for (uint32_t i = 0; i < nAp; ++i)
{
UdpServerHelper server(port);
serverApps.Add(server.Install(wifiApNodes.Get(i)));
}
for (uint32_t i = 0; i < nAp; ++i)
{
for (uint32_t j = 0; j < staPerAp; ++j)
{
uint32_t staIndex = i * staPerAp + j;
UdpClientHelper client(apInterfaces.GetAddress(i), port);
client.SetAttribute("MaxPackets", UintegerValue(4294967295U));
client.SetAttribute("Interval", TimeValue(Seconds(payloadSize * 8.0 / maxLoad)));
client.SetAttribute("PacketSize", UintegerValue(payloadSize));
clientApps.Add(client.Install(wifiStaNodes.Get(staIndex)));
}
}
}
serverApps.Start(Seconds(0));
serverApps.Stop(simulationTime + Seconds(1));
clientApps.Start(Seconds(1));
clientApps.Stop(simulationTime + Seconds(1));
}
else
{
// TCP flow
uint16_t port = 50000;
if (downlink)
{
// Downlink: servers on STAs, clients on APs
for (uint32_t i = 0; i < totalSta; ++i)
{
Address localAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
serverApps.Add(packetSinkHelper.Install(wifiStaNodes.Get(i)));
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
onoff.SetAttribute("OnTime",
StringValue("ns3::ConstantRandomVariable[Constant=1]"));
onoff.SetAttribute("OffTime",
StringValue("ns3::ConstantRandomVariable[Constant=0]"));
onoff.SetAttribute("PacketSize", UintegerValue(payloadSize));
onoff.SetAttribute("DataRate", DataRateValue(maxLoad));
AddressValue remoteAddress(
InetSocketAddress(staInterfaces.GetAddress(i), port));
onoff.SetAttribute("Remote", remoteAddress);
// Find which AP this STA belongs to
uint32_t apIndex = i / staPerAp;
clientApps.Add(onoff.Install(wifiApNodes.Get(apIndex)));
}
}
else
{
// Uplink: servers on APs, clients on STAs
for (uint32_t i = 0; i < nAp; ++i)
{
Address localAddress(InetSocketAddress(Ipv4Address::GetAny(), port));
PacketSinkHelper packetSinkHelper("ns3::TcpSocketFactory", localAddress);
serverApps.Add(packetSinkHelper.Install(wifiApNodes.Get(i)));
}
for (uint32_t i = 0; i < nAp; ++i)
{
for (uint32_t j = 0; j < staPerAp; ++j)
{
uint32_t staIndex = i * staPerAp + j;
OnOffHelper onoff("ns3::TcpSocketFactory", Ipv4Address::GetAny());
onoff.SetAttribute("OnTime",
StringValue("ns3::ConstantRandomVariable[Constant=1]"));
onoff.SetAttribute("OffTime",
StringValue("ns3::ConstantRandomVariable[Constant=0]"));
onoff.SetAttribute("PacketSize", UintegerValue(payloadSize));
onoff.SetAttribute("DataRate", DataRateValue(maxLoad));
AddressValue remoteAddress(
InetSocketAddress(apInterfaces.GetAddress(i), port));
onoff.SetAttribute("Remote", remoteAddress);
clientApps.Add(onoff.Install(wifiStaNodes.Get(staIndex)));
}
}
}
serverApps.Start(Seconds(0));
serverApps.Stop(simulationTime + Seconds(1));
clientApps.Start(Seconds(1));
clientApps.Stop(simulationTime + Seconds(1));
}
Simulator::Schedule(Seconds(0), &Ipv4GlobalRoutingHelper::PopulateRoutingTables);
Simulator::Stop(simulationTime + Seconds(1));
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)
// auto tolerance = 0.10;
float rxBytes[100] = {0.0};
float throughput[100] = {0.0};
if (udp)
{
// printf("%d\n", serverApps.GetN());
for (uint32_t i = 0; i < serverApps.GetN(); i++)
{
rxBytes[i] =
payloadSize * DynamicCast<UdpServer>(serverApps.Get(i))->GetReceived();
throughput[i] = (rxBytes[i] * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
}
}
else
{
for (uint32_t i = 0; i < serverApps.GetN(); i++)
{
rxBytes[i] = DynamicCast<PacketSink>(serverApps.Get(i))->GetTotalRx();
throughput[i] = (rxBytes[i] * 8) / simulationTime.GetMicroSeconds(); // Mbit/s
}
}
Simulator::Destroy();
// for (uint32_t i = 0; i < nAp; i++)
// {
// std::cout << + i << "\t\t\t" << +mcs << "\t\t\t" << widthStr << " MHz\t\t"
// << (widthStr.size() > 3 ? "" : "\t") << gi << " ns\t\t\t" << throughput[i]
// << " Mbit/s" << std::endl;
// }
float t_sum = 0;
for (uint32_t i = 0; i < serverApps.GetN(); i++)
{
t_sum = t_sum + throughput[i];
}
printf("ap distance:%f\t%f\n", apDistance, t_sum);
for (uint32_t i = 0; i < serverApps.GetN(); i++)
{
printf("%f\t", throughput[i]);
if(((staPerAp*nGrid) -1) == (i%(staPerAp*nGrid)))
{
printf("\n");
}
}
index++;
apDistance = apDistance + 10;
printf("\n");
}
}
}
return 0;
}
将上面的ap 1上的sta, 连接到ap0上,其他保持不变
最新发布