When I get the Pcap files I see that all stations are transmitting beacons at the same time and these beacons are not received by anyone else.
How could I make it so I can see how the different APs have to wait for each other to transmit a beacon, and that the STA receives them?
int main (int argc, char *argv[])
{
uint32_t payloadSize = 1472; //bytes
uint64_t simulationTime = 10; //seconds
double distance = 5; //meters
bool enablePcap = 0;
CommandLine cmd;
cmd.AddValue ("payloadSize", "Payload size in bytes", payloadSize);
cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
cmd.AddValue ("distance", "Distance in meters between the station and the access point", distance);
cmd.AddValue ("enablePcap", "Enable/disable pcap file generation", enablePcap);
cmd.Parse (argc, argv);
NodeContainer wifiStaNode;
wifiStaNode.Create (1);
NodeContainer wifiApNode;
wifiApNode.Create (7);
YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (channel.Create ());
WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("HtMcs7"), "ControlMode", StringValue ("HtMcs0"));
WifiMacHelper mac;
NetDeviceContainer staDeviceA,/* staDeviceB, staDeviceC, staDeviceD,*/ apDeviceA, apDeviceB, apDeviceC, apDeviceD, apDeviceE, apDeviceF, apDeviceG;
Ssid ssid;
//Network A
ssid = Ssid ("network-A");
phy.Set ("ChannelNumber", UintegerValue(40));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
staDeviceA = wifi.Install (phy, mac, wifiStaNode.Get(0));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true));
apDeviceA = wifi.Install (phy, mac, wifiApNode.Get(0));
//Network B
ssid = Ssid ("network-B");
phy.Set ("ChannelNumber", UintegerValue(40));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"BE_MaxAmpduSize", UintegerValue (0));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true));
apDeviceB = wifi.Install (phy, mac, wifiApNode.Get(1));
//Network C
ssid = Ssid ("network-C");
phy.Set ("ChannelNumber", UintegerValue(40));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true));
apDeviceC = wifi.Install (phy, mac, wifiApNode.Get(2));
//Network D
ssid = Ssid ("network-D");
phy.Set ("ChannelNumber", UintegerValue(40));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true));
apDeviceD = wifi.Install (phy, mac, wifiApNode.Get(3));
//Network E
ssid = Ssid ("network-E");
phy.Set ("ChannelNumber", UintegerValue(40));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true));
apDeviceE = wifi.Install (phy, mac, wifiApNode.Get(4));
//Network F
ssid = Ssid ("network-F");
phy.Set ("ChannelNumber", UintegerValue(40));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true));
apDeviceF = wifi.Install (phy, mac, wifiApNode.Get(5));
//Network G
ssid = Ssid ("network-G");
phy.Set ("ChannelNumber", UintegerValue(40));
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid));
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true));
apDeviceG = wifi.Install (phy, mac, wifiApNode.Get(6));
/* Setting mobility model */
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
//Set position for APs
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (-0.1, 0.0, 0.0));
positionAlloc->Add (Vector (17.32, 0.0, 0.0));
positionAlloc->Add (Vector (-8.66, 15.0, 0.0));
positionAlloc->Add (Vector (8.66, 15.0, 0.0));
positionAlloc->Add (Vector (-8.66, -15.0, 0.0));
positionAlloc->Add (Vector (8.66, -15.0, 0.0));
//Set position for STA
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.Install (wifiApNode);
mobility.Install (wifiStaNode);
/* Internet stack */
InternetStackHelper stack;
stack.Install (wifiApNode);
stack.Install (wifiStaNode);
Ipv4AddressHelper address;
address.SetBase ("192.168.1.0", "255.255.255.0");
Ipv4InterfaceContainer StaInterfaceA;
StaInterfaceA = address.Assign (staDeviceA);
Ipv4InterfaceContainer ApInterfaceA;
ApInterfaceA = address.Assign (apDeviceA);
address.SetBase ("192.168.2.0", "255.255.255.0");
Ipv4InterfaceContainer ApInterfaceB;
ApInterfaceB = address.Assign (apDeviceB);
address.SetBase ("192.168.3.0", "255.255.255.0");
Ipv4InterfaceContainer ApInterfaceC;
ApInterfaceC = address.Assign (apDeviceC);
address.SetBase ("192.168.4.0", "255.255.255.0");
Ipv4InterfaceContainer ApInterfaceD;
ApInterfaceD = address.Assign (apDeviceD);
address.SetBase ("192.168.5.0", "255.255.255.0");
Ipv4InterfaceContainer ApInterfaceE;
ApInterfaceE = address.Assign (apDeviceE);
address.SetBase ("192.168.6.0", "255.255.255.0");
Ipv4InterfaceContainer ApInterfaceF;
ApInterfaceF = address.Assign (apDeviceF);
address.SetBase ("192.168.7.0", "255.255.255.0");
Ipv4InterfaceContainer ApInterfaceG;
ApInterfaceG = address.Assign (apDeviceG);
if (enablePcap)
{
phy.EnablePcap ("AP_A", apDeviceA.Get (0), true);
phy.EnablePcap ("AP_B", apDeviceB.Get (0), true);
phy.EnablePcap ("AP_C", apDeviceC.Get (0), true);
phy.EnablePcap ("AP_D", apDeviceD.Get (0), true);
phy.EnablePcap ("STA_A", staDeviceA.Get (0), true);
}
Simulator::Stop (Seconds (simulationTime + 1));
Simulator::Run ();
Simulator::Destroy ();
return 0;
}