A hierarchy in WLANs

127 views
Skip to first unread message

Varun Reddy

unread,
May 4, 2017, 5:24:02 PM5/4/17
to ns-3-users
Hi everyone,

Say I want to have 3 APs serving 60 users, and these APs are in turn wirelessly (Using Wifi) connected to the server. How would I create such a topology? At this moment, I was thinking that 'wifiStaNodes' can represent the users, 'wifiApNodes' can represent the APs, but how do I make these APs relay information to the server through Wifi? This is my attempt: I have created 'wifiAp2Nodes', which is a collection of the APs and the server.

I have attached my code in this thread. I receive the following error:
aborted. cond="!(networkHere == networkThere)", msg="GlobalRouter::ProcessSingleBroadcastLink(): Network number confusion", file=../src/internet/model/global-router-interface.cc, line=852

Thanks,
Varun


wifi_sample.cc

Varun Reddy

unread,
May 5, 2017, 10:00:10 PM5/5/17
to ns-3-users
Alright so I've found the source of the problem.

The WiFi stations are installed with the 'StaWifiMac' Mac type:
NetDeviceContainer staDevices;
mac.SetType ("ns3::StaWifiMac","Ssid", SsidValue (ssid),"ActiveProbing", BooleanValue (false));
staDevices = wifi.Install (phy, mac, wifiStaNodes);

The WiFi APs are installed with the 'ApWifiMac' Mac type:
NetDeviceContainer apDevices;
mac.SetType ("ns3::ApWifiMac","Ssid", SsidValue (ssid));
apDevices  = wifi.Install (phy, mac, wifiApNodes);

In my scenario, I'm trying to make the APs act as Stations to another 'superior' AP. I'm guessing this wouldn't be possible?

Tommaso Pecorella

unread,
May 6, 2017, 5:23:57 AM5/6/17
to ns-3-users
Hi,

it is possible, but you need to install multiple Wi-Fi devices on the APs, one to be the AP and one to be the STA for the "upper" level.

T.
Message has been deleted
Message has been deleted
Message has been deleted

Varun Reddy

unread,
May 6, 2017, 11:35:11 PM5/6/17
to ns-3-users
Oh I see. I've tried to do that now, but can't seem to find the cause of the problem. I get the following error message: cond="!(networkHere == networkThere)", msg="GlobalRouter::ProcessSingleBroadcastLink(): Network number confusion", file=../src/internet/model/global-router-interface.cc, line=852
Here is a snippet of my code:

//Topology
// ------> denotes a Wifi Link

u0 u1 u2
.....   ------> AP1
..............
..............   ------> AP2  -----> Server
..............
...u58 u59 u60   ------> AP3  

int nWifi = 60;
int nAP = 3;

NodeContainer allNodes;

NodeContainer wifiStaNodes; //User Nodes
wifiStaNodes
.Create (nWifi);
allNodes
.Add (wifiStaNodes);

NodeContainer wifiApNodes ; //Access Points
wifiApNodes
.Create (nAP);
allNodes
.Add (wifiApNodes);

NodeContainer wifiServer; //Server
wifiServer
.Create (1);
allNodes
.Add(wifiServer.Get(0));  

YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
WifiHelper wifi;
wifi
.SetRemoteStationManager ("ns3::ConstantRateWifiManager","DataMode", StringValue("VhtMcs9"), "ControlMode", StringValue("VhtMcs9"));
wifi
.SetStandard (WIFI_PHY_STANDARD_80211af);
channel
.AddPropagationLoss("ns3::TwoRayGroundPropagationLossModel","Frequency",DoubleValue(300e+06));

//Setting Physical layer parameters for the User Nodes
phy
.Set("TxPowerStart",DoubleValue(20)); // 40mW = 16.02dBm
phy
.Set("TxPowerEnd",DoubleValue(20));
phy
.Set("TxPowerLevels", UintegerValue(1));
phy
.Set("TxGain",DoubleValue(0));
phy
.Set("RxGain",DoubleValue(-3));
phy
.Set("EnergyDetectionThreshold",DoubleValue(-88));
phy
.SetChannel (channel.Create ());

WifiMacHelper mac;
Ssid ssid = Ssid ("ns-3-ssid");


NetDeviceContainer staDevices;
mac
.SetType ("ns3::StaWifiMac","Ssid", SsidValue (ssid),"ActiveProbing", BooleanValue (false));
staDevices
= wifi.Install (phy, mac, wifiStaNodes);

//Setting Physical Layer parameters for Access Points and Server
phy
.Set("TxPowerStart",DoubleValue(20)); // 40mW = 16.02dBm
phy
.Set("TxPowerEnd",DoubleValue(20));
phy
.Set("TxPowerLevels", UintegerValue(1));
phy
.Set("TxGain",DoubleValue(30));
phy
.Set("RxGain",DoubleValue(0));
phy
.Set("EnergyDetectionThreshold",DoubleValue(-78));

NetDeviceContainer apDevices,serverDevice,ap_staDevices;

mac
.SetType ("ns3::ApWifiMac","Ssid", SsidValue (ssid));

apDevices      
= wifi.Install (phy, mac, wifiApNodes); // The APs

serverDevice   = wifi.Install (phy, mac, wifiServer);  // The Server
mac.SetType ("ns3::StaWifiMac","Ssid", SsidValue (ssid),"ActiveProbing", BooleanValue (false))
ap_staDevices  = wifi.Install (phy, mac, wifiApNodes); // The devices in the APs that are stations to the superior AP

Ptr<BasicEnergySource> energySource = CreateObject<BasicEnergySource>();
Ptr<SimpleDeviceEnergyModel> energyModel = CreateObject<SimpleDeviceEnergyModel>();

energySource
->SetInitialEnergy (100);
energyModel
->SetEnergySource (energySource);
energySource
->AppendDeviceEnergyModel (energyModel);
energyModel
->SetCurrentA (20);

// aggregate energy source to node
wifiServer
.Get(0)->AggregateObject (energySource);

// Install internet stack
InternetStackHelper stack;
stack
.Install (allNodes);

// Install Ipv4 addresses
Ipv4AddressHelper address;
address
.SetBase ("10.1.0.0", "255.255.192.0");
address
.Assign (staDevices);
address
.Assign (apDevices);
address
.SetBase ("10.2.0.0", "255.255.192.0");
Ipv4InterfaceContainer serverInterface;
serverInterface
= address.Assign (serverDevice);
address
.Assign (ap_staDevices);

// Install applications

UdpEchoServerHelper echoServer (9);
ApplicationContainer serverApps = echoServer.Install (wifiServer.Get(0));
serverApps
.Start (Seconds (1.0));
serverApps
.Stop (Seconds (5.0));
UdpEchoClientHelper echoClient (serverInterface.GetAddress(0), 9);
echoClient
.SetAttribute ("MaxPackets", UintegerValue (10));
echoClient
.SetAttribute ("Interval", TimeValue (Seconds (3)));
echoClient
.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (wifiStaNodes);
clientApps
.Start (Seconds (2.0));
clientApps
.Stop (Seconds (5.0));

Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
Simulator::Stop (Seconds (4.0));

P.S: Could the owner of this google group allow the members to edit their posts? At this moment, it seems like we have to delete the post and re-post it after correcting any errors.


Tommaso Pecorella

unread,
May 7, 2017, 5:24:59 AM5/7/17
to ns-3-users
Hi,

the two "layers" should have different channel number / SSID.
If the error is still there try with ns-3-dev.

T.

PS: I'll ask about doing edits to posts.

Varun Reddy

unread,
May 7, 2017, 10:55:45 AM5/7/17
to ns-3-users
Yes I tried that as well, and still no luck. I was wondering if the problem is because the different devices on the same node might have to be connected in some way? Do I need to modify the routing tables for the APs (the internal routing, between the two devices)?

Thanks,
Varun

Tommaso Pecorella

unread,
May 7, 2017, 11:31:27 AM5/7/17
to ns-3-users
Without the full code it's not really possible to further investigate.
The error should be fixed in ns-3-dev, assuming that you did what I said. However, it is still possible that the bug wasn't fixed for good.
Nevertheless, without full code... 

T.

Varun Reddy

unread,
May 7, 2017, 1:13:12 PM5/7/17
to ns-3-users
Hello,

I have attached a couple of files here. I will continue to look in ns-3-dev for fixes, but as of now I can't seem to find the relevant files.

Thank you,
Varun
wifi_sample.cc
wifi-phy.cc

Tommaso Pecorella

unread,
May 7, 2017, 4:11:23 PM5/7/17
to ns-3-users
Hi,

let's forget that you should have cleaned the script to be built on a "standard" ns-3 release (you forgot to ad some header files)...

The issue (sorry, I didn't remember correctly) is that you can not have GlobalRouting on the STAs, or you'll end up with a loop.
The "trick" is to have GlobalRouting on the AP, and a StaticRouting only on the STAs. On the STAs you'll have to set a DefaultRoute to the AP. 

In your case, since one AP is also a STA, you'll need to use a little more tricks, basically adding more static routes to the other nodes, just to tell the whole network that the "bottom" network is there.

As a side note, this could be mitigated by DHCP (not yet in ns-3, work in progress), but it is ultimately a GlobalRouting enhancement.

T.

Tommaso Pecorella

unread,
May 7, 2017, 4:14:33 PM5/7/17
to ns-3-users
Oh, I forgot...

when i said to use different channels and SSIDs, I meant one channel and one SSID for each Wi-Fi network. In your script there are 3 APs with the same channel and SSID...

T.


On Sunday, May 7, 2017 at 7:13:12 PM UTC+2, Varun Reddy wrote:

Varun Reddy

unread,
May 8, 2017, 12:21:27 AM5/8/17
to ns-3-users
Ah alright! So it is a problem with the Routing method. I happened to notice some other users faced problems in AODV and OSLR implementations too.

Thanks a lot for your help Tommaso!

Varun
Reply all
Reply to author
Forward
0 new messages