set root node in mesh network

430 views
Skip to first unread message

nabil torjemen

unread,
Feb 24, 2015, 1:25:59 PM2/24/15
to ns-3-...@googlegroups.com
Hi for all,
As described in the mesh example, I have write a code to create a mesh network.
However, I have 8 static nodes with a specific position. I need to set one of them as root.
how to do it ?
I find that in the hwmp-protocol file.cc, the function void HwmpProtocol::SetRoot (), is it the right function used to define the root node ?
Best regards.

nabil torjemen

unread,
Feb 26, 2015, 6:43:51 AM2/26/15
to ns-3-...@googlegroups.com
What shoudl I do ?
Please help me.

Tommaso Pecorella

unread,
Feb 26, 2015, 11:52:58 AM2/26/15
to ns-3-...@googlegroups.com
What do you want to do ?
SetRoot sets the root for the HWMP proactive mode. Is this what you want to do ?
How can we tell you "yes, it's the right thing to do" if you don't tell what's your goal ?
Please, when asking for help/instructions state clearly what's the problem. Moreover, please consider that we're here to help on specific issues. It's not our task/duty to substitute your tutor.

T.

nabil torjemen

unread,
Feb 26, 2015, 2:41:21 PM2/26/15
to ns-3-...@googlegroups.com
Hi for all;
Sorry for the misunderstanding.
I have use the code provided in the mesh example to create a mesh network including 8 static nodes and having a specific  location. The script is below:

MeshTest::CreateNodes ()
{
    /*
     * Create 8 MAPs according to our configuration
     */

    nodes.Create (m_node);
    // Configure YansWifiChannel
    YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
    YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
    wifiPhy.SetChannel (wifiChannel.Create ());
    /*
     * Create mesh helper and set stack installer to it
     * Stack installer creates all needed protocols and install them to
     * mesh point device
     */
    mesh = MeshHelper::Default ();
       
       
    if (!Mac48Address (m_root.c_str ()).IsBroadcast ())
    {
      mesh.SetStackInstaller (m_stack, "Root", Mac48AddressValue (Mac48Address (m_root.c_str ())));
     
    }
  else
    {
      //If root is not set, we do not use "Root" attribute, because it
      //is specified only for 11s
      mesh.SetStackInstaller (m_stack);
    }
    if (m_chan)
    {
        mesh.SetSpreadInterfaceChannels (MeshHelper::SPREAD_CHANNELS);
    }
    else
    {
        mesh.SetSpreadInterfaceChannels (MeshHelper::ZERO_CHANNEL);
    }
   
    mesh.SetMacType ("RandomStart", TimeValue (Seconds (m_randomStart)));
    // Set number of interfaces - two interface (one for backbone + one for Wifi)
    mesh.SetNumberOfInterfaces (m_nIfaces);
   
    // Install protocols and return container if MeshPointDevices
    meshDevices = mesh.Install (wifiPhy, nodes);
       
    // Setup mobility - static topology for Mesh network part
    MobilityHelper mobility;
    Ptr<ListPositionAllocator> positionAlloc =
        CreateObject<ListPositionAllocator>();
    positionAlloc->Add (Vector (330.0, 380.0, 0.0));
    positionAlloc->Add (Vector (350.0, 400.0, 0.0));
    positionAlloc->Add (Vector (370.0, 420.0, 0.0));
    positionAlloc->Add (Vector (500.0, 300.0, 0.0));
    positionAlloc->Add (Vector (740.0, 350.0, 0.0));
    positionAlloc->Add (Vector (250.0, 800.0, 0.0));
    positionAlloc->Add (Vector (500.0, 740.0, 0.0));
    positionAlloc->Add (Vector (720.0, 720.0, 0.0));
    mobility.SetPositionAllocator (positionAlloc);
    mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
    mobility.Install (nodes);
                        
            
    if (m_pcap)
        wifiPhy.EnablePcapAll (std::string ("mp-"));
}

Now I need to set the node having the position (250.0, 800.0, 0.0) as a root node for HWMP.
my problem is that the function setroot does not allows to choose the node. How can I do it ?
Hope things are more clear now.
best regards.

Tommaso Pecorella

unread,
Feb 26, 2015, 4:23:45 PM2/26/15
to ns-3-...@googlegroups.com
Hi,

it took me 2 minutes to figure out. Either I'm a genius (I doubt about it) or you're extremely lazy.
TypeId
Dot11sStack::GetTypeId ()
{
 
static TypeId tid = TypeId ("ns3::Dot11sStack")
   
.SetParent<Object> ()
   
.AddConstructor<Dot11sStack> ()
   
.AddAttribute ("Root",
                   
"The MAC address of root mesh point.",
                   
Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")),
                   
MakeMac48AddressAccessor (&Dot11sStack::m_root),
                   
MakeMac48AddressChecker ());
 
return tid;
}

Please don't rely (always) on other's help. We may as well have other things to do and you'd be stuck in simple things.

T.

nabil torjemen

unread,
Feb 26, 2015, 5:23:16 PM2/26/15
to ns-3-...@googlegroups.com
Hi Tommaso;
I'm not lazy and I will never be lazy. I have never develop using C++ and I'm a beginner in Oriented Object programming so It is very hard for me to understand code.
I'm trying my best to understand the code and learn about C++ and oriented object programming via available doc in the internet and I have not any teacher to help me. For that reason, it seems that I'm lazy but it not the case.
Now, I will try to understand what have you do in 2 minutes and how to use it.
Thanks for your help and I hope that you can understand more my situation.
In all case, I will never give up and I'm sure that I will write the needed script.
Best regards.

Tommaso Pecorella

unread,
Feb 27, 2015, 2:34:23 AM2/27/15
to ns-3-...@googlegroups.com
Hi,

I like your attitude, it's what I was hoping for: a stand up. Keep learning and you'll develop your skills.
And now, since you're a OO beginner, I'll tell you how I did it.
First and foremost, following an OOP program is all about the jumps. If you try to follow it using the procedural method (i.e., following the functions call path), you'll be lost in no time.
Second trick: grep is your best friend (along with your IDE).
In this specific case, you asked about the SetRoot function. Open it: it fires an event and sets a member function named "m_isRoot". In ns-3, the variables named m_something are instance variables (naming convention, it's valid for ns-3 only). It seems important, lets's see where it's used.
In this case Eclipse helps. Right-click on the variables and select "References->in project". It's used in 4 places, but one is ringing a bell: DoInitialize. Let's see what's there.
void
HwmpProtocol::DoInitialize ()
{
  m_coefficient
->SetAttribute ("Max", DoubleValue (m_randomStart.GetSeconds ()));
 
if (m_isRoot)
   
{
     
SetRoot ();
   
}
}

Recursive ? It's a dead end. It's DoInitialize calling SetRoot, at least we know that m_isRoot should be set somewhere else.
Since it seems that it is never set (and that's strange), let's try with a plain search. Terminal.
$ grep -r m_isRoot src/mesh

Nothing new.
Good, we just found some dead code (submit a bug).

There must be something else. Let's double-check if "SetRoot" is called just by DoInitialize. Again, Eclipse helps.
Oh, an interesting hint: it's called by Dot11sStack::InstallStack, and the code is...
  if (mp->GetAddress () == m_root)
   
{
      hwmp
->SetRoot ();
   
}

m_root is a Dot11sStack member variable, and it's initialized to "ff:ff:ff:ff:ff:ff" in the constructor. BUT it's also used in an Attribute.
There it is. What we was searching for.

See? Once you learn the tricks it's easy (and fast).

Keep up the good work,

T.

nabil torjemen

unread,
Feb 27, 2015, 8:18:36 AM2/27/15
to ns-3-...@googlegroups.com
Hi,
Thanks for your help and answer.
I have write the following code to set the second node as the root for my mesh network:
MeshPointDevice root_MeshPointDevice;
root_MeshPointDevice
.SetNode(nodes.Get(1));
Dot11sStack dot11s;
dot11s
.InstallStack(&root_MeshPointDevice);

is it correct ?
Best regards.

Tommaso Pecorella

unread,
Feb 27, 2015, 10:44:39 AM2/27/15
to ns-3-...@googlegroups.com
It should be right. I never tried.

T.

nabil torjemen

unread,
Feb 28, 2015, 5:01:05 PM2/28/15
to ns-3-...@googlegroups.com
Hi;
OK. Thanks for your help.
Br.

nabil torjemen

unread,
Mar 1, 2015, 1:49:23 PM3/1/15
to ns-3-...@googlegroups.com
Hi Tommaso,
the code that I have already proposed set the second node as root.
however, the node is including three interfaces (two wireless and one wired).
How to fix it ?
Best regards.

Tommaso Pecorella

unread,
Mar 1, 2015, 1:51:26 PM3/1/15
to ns-3-...@googlegroups.com
Sorry but... fix WHAT ?
I guess the node didn't end up to have 3 interface by itself, right ?

T

nabil torjemen

unread,
Mar 1, 2015, 4:25:15 PM3/1/15
to ns-3-...@googlegroups.com
Hi,
the node is including three interfaces one for infrasturce using 5 Ghz band + one for non infrastrustructe (it will be used as Acces point) using the 2.4 GHz + one wired link to be connected to the PGW.
so I need to set root for just only the first interface which is a mesh network.
Br

Tommaso Pecorella

unread,
Mar 1, 2015, 4:31:10 PM3/1/15
to ns-3-...@googlegroups.com
I still don't see the problem. Do it, the function do exactly that, so you just have to do it. What's the problem ?

T.

nabil torjemen

unread,
Mar 1, 2015, 5:20:12 PM3/1/15
to ns-3-...@googlegroups.com
Hi,
let me show again the code:

MeshPointDevice root_MeshPointDevice;
root_MeshPointDevice
.SetNode(nodes.Get(1));
Dot11sStack dot11s;
dot11s
.InstallStack(&root_MeshPointDevice);

in the line 2:
root_MeshPointDevice.SetNode(nodes.Get(1));
we use the function setnode to setup the second nodes  as root.

However, this node has 3 interfaces connected to differents networks. So the setnode function will set all the three interfaces as root in their respectively connected networks or not ?
my issue is just to use only one interfaces from the three connected to the second node and set it as root as this interfaces is connected to a mesh network.

hope I have explain more my issue.

Best regards.

Tommaso Pecorella

unread,
Mar 2, 2015, 2:48:25 AM3/2/15
to ns-3-...@googlegroups.com
Hi,

this code doesn't do what you want/said. It seems that you're skipping the helper in the hope to set the root node, while you're not doing that.

The "root" knowledge isn't something important to be known by the root node itself, it's something to be installed in the OTHER nodes. That's what the helper does. Please study the code.
What you should do is:
1) install the mesh stack in one node.
2) find what's the MAC address of the interface you just created (discussed a lot in the group)
3) modify the helper to set that address as root
4) install the stack on the other nodes.

T.

nabil torjemen

unread,
Mar 3, 2015, 3:27:03 AM3/3/15
to ns-3-...@googlegroups.com
Hi Tommaso;

It seems that I have some fundamentals issues.

what is the difference between Meshpointdevice and mesh.SetNumberOfInterfaces (m_nIfaces);

When I see the code, Meshpointdevice is a class which define a netdevice and SetNumberOfInterfaces define the number of device in the node.
so when, I souhld use netdevice or interface ?

In other hand, the method SetNumberOfInterfaces define the number of interface using the meshhelper and then set it for all node in the nodeconatainer using meshDevices = mesh.Install (wifiPhy, nodes);
but if there is a node using 2 interfaces and others using 3 interfaces, should I define them in a separte nodecontainer.
Best regards.

Tommaso Pecorella

unread,
Mar 3, 2015, 4:11:03 AM3/3/15
to ns-3-...@googlegroups.com
Hi,

you definitely need to stop hitting the keyboard with random code and take your time to understand the ns-3 structure.

A NetDevice is what is "seen" by the L3 protocols. You (typically) create NetDevices through the associate helper class, because setting up a NetDevice manually is quite complex.
About "interfaces", they aren't formally defined, and the perm may refer to many things. E.g., at IP layer you call "interface" any NetDevice connected to IP. It's not that obvious that all the NetDevices are connected to IP.
Moreover, a NetDevice may "hide" other NetDevices. SixLowPanNetDevice does that, and MeshPointDevice too.
Check the code in the helper, it's piss easy:
      for (uint32_t i = 0; i < m_nInterfaces; ++i)
       
{
          uint32_t channel
= 0;
         
if (m_spreadChannelPolicy == ZERO_CHANNEL)
           
{
              channel
= 0;
           
}
         
if (m_spreadChannelPolicy == SPREAD_CHANNELS)
           
{
              channel
= i * 5;
           
}
         
Ptr<WifiNetDevice> iface = CreateInterface (phyHelper, node, channel);
          mp
->AddInterface (iface);
       
}

It creates m_nInterfaces in each node and it makes them all act as one in a single MeshPointDevice.

What you want for the root is the MAC address of the MeshPointDevice of the root node.

T.

nabil torjemen

unread,
Mar 3, 2015, 7:48:58 AM3/3/15
to ns-3-...@googlegroups.com
Hi Tommaso;
I'm trying to understand the ns-3 structure using the tutorial.
in the 4.1 Key abstractions, they are a couple of definition that can help to undersatnd ns-3.
According to this section, we can say that netdevice/Meshpointdevice can model both software driver and simulated hardware - typically NIC;
However, the interface can model what exactly ? the physical interface in the NIC ?
best regards.

Tommaso Pecorella

unread,
Mar 3, 2015, 9:09:32 AM3/3/15
to ns-3-...@googlegroups.com
The MeshDevice is like a virtual NIC. Much like when you bridge two network interfaces together - you have a 3rd virtual network interface, and it hides the other two.

Hope this clarifies a bit,

T.

nabil torjemen

unread,
Mar 4, 2015, 4:47:20 PM3/4/15
to ns-3-...@googlegroups.com
Hi,
I Have try my best to write a code which create the enclosed topology.
/*
         create the mesh part
        */

       
        mesh_nodes
.Create (6); // Create 6 nodes mesh  

       
       
// Configure YansWifiChannel
   
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
   
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
    wifiPhy
.SetChannel (wifiChannel.Create ());

   
/*
     * Create mesh helper and set stack installer to it
     * Stack installer creates all needed protocols and install them to
     * mesh point device
     */

    mesh
= MeshHelper::Default ();

               
    mesh
.SetMacType ("RandomStart", TimeValue (Seconds (m_randomStart)));
   
       
// Set number of interfaces for default AP
    mesh
.SetNumberOfInterfaces (m_nIfaces);
           
   
// Install protocols and return container if default MeshPointDevices
        mesh_NetDevices
= mesh.Install (wifiPhy, mesh_nodes);      
         
   
// Setup mobility - static topology for default AP

   
MobilityHelper mobility;
   
Ptr<ListPositionAllocator> positionAlloc =
               
CreateObject<ListPositionAllocator>();

    positionAlloc
->Add (Vector (330.0, 380.0, 0.0));// AP in Building 1
        positionAlloc
->Add (Vector (500.0, 300.0, 0.0));// AP in Building 2
    positionAlloc
->Add (Vector (740.0, 350.0, 0.0));// AP in Building 3
    positionAlloc
->Add (Vector (250.0, 800.0, 0.0));// AP in Building 4 : the root node
        positionAlloc
->Add (Vector (500.0, 740.0, 0.0));// AP in Building 5
    positionAlloc
->Add (Vector (720.0, 720.0, 0.0));// AP in Building 6

    mobility
.SetPositionAllocator (positionAlloc);
    mobility
.SetMobilityModel ("ns3::ConstantPositionMobilityModel");

        mobility
.Install (mesh_nodes);            
         
       
MeshPointDevice root_MeshPointDevice;
        root_MeshPointDevice
.SetNode(mesh_nodes.Get(3));// set the root node
       
Dot11sStack dot11s;
        dot11s
.InstallStack(&root_MeshPointDevice);
       
       
// Create wifi helper and set the mesh frequence at 5 GHz
        wifi
=  WifiHelper::Default();
        wifi
.SetStandard(WIFI_PHY_STANDARD_80211n_5GHZ);
               
       
/*
         create the wifi part
         */
           
       
// Create 7 nodes wifi      
        wifi_AP_nodes
.Add(mesh_nodes);// create 6 AP
        wifi_AP_nodes
.Create (1); // add the second node in building 1
       
QosWifiMacHelper mac = QosWifiMacHelper::Default();  
        wifi
.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate54Mbps"));
        wifi_AP_NetDevices
= wifi.Install (wifiPhy, mac, wifi_AP_nodes);
       
       
// Create wifi helper and set the wifi frequence at 2.4 GHz
        wifi
.SetStandard(WIFI_PHY_STANDARD_80211n_2_4GHZ);
               
       
Ssid ssid = Ssid ("ns-3-ssid");
        mac
.SetType ("ns3::ApWifiMac",
               
"Ssid", SsidValue (ssid),
               
"BeaconGeneration", BooleanValue (true),
               
"BeaconInterval", TimeValue (Seconds (5)));
   
   
InternetStackHelper internetStack;
    internetStack
.Install (mesh_nodes);
    internetStack
.Install (wifi_AP_nodes);
       
Ipv4AddressHelper address;
    address
.SetBase ("10.1.1.0", "255.255.255.0");
    mesh_interfaces
= address.Assign (mesh_NetDevices);
        wifi_AP_interfaces
= address.Assign (wifi_AP_NetDevices);


Is this code is correct ?
mesh.bmp

Tommaso Pecorella

unread,
Mar 5, 2015, 11:31:00 AM3/5/15
to ns-3-...@googlegroups.com


On Wednesday, March 4, 2015 at 10:47:20 PM UTC+1, nabil torjemen wrote:
Hi,
I Have try my best to write a code which create the enclosed topology.

Is this code is correct ?

No, but I'm not your tutor.
If you have a doubt about a function or something, feel free to ask. However I have already my students to follow, I can't also do the job of your tutor, isn't it ?

T, 

nabil torjemen

unread,
Mar 5, 2015, 1:46:52 PM3/5/15
to ns-3-...@googlegroups.com
Hi,
In all case thanks for your help and support.
As I said last time, I have no tuto.
However, I think it will be better to discard and leave the use of ns3.
It is not an easy tool to learn for beginner and there is not an easy way to learn how to do. It need a good knoweldge on OOP.
The help include only function doubt is not enough for beginner. I have try to understand and write the code but it is not correct and I'm not able to know where is the problem and how to check if the code is correct or not.
Thanks again for your help.
Best regards.

Tommaso Pecorella

unread,
Mar 5, 2015, 2:42:13 PM3/5/15
to ns-3-...@googlegroups.com
Hi,

I'm sorry you decided to give up. However, let me point out one thing: ns-3 is as difficult to use as any similar network simulator. 
Perhaps the issue is that you're trying to learn ns-3 AND Object orienting at the same time ?
Perhaps it's that you are trying to obtain results right away skipping all the training part ?
No idea, the point is that you didn't want (or you couldn't) take enough time to learn what you was trying to use.
In this cases, the only help I (we) can give is: if you don't want (or you can't) put enough effort (including time) in what you're doing, you'd better pay someone to do it for you.

As a side note, in the specific case I can name what made me jump.
1) The root node. I explained quite well how to set it up. The mesh example shows exactly how to do it. Still, you got it totally wrong.
2) The 2.4GHz / 5GHz is... ? I can't even figure out what was meant to do. And trust me, it's not an Object Orienting or a ns-3 thing. It's programming 101.

You say you're not able to understand and see if your code is correct. Perhaps, but then you should ask a different thing. The right question would have to be "how can I learn", not "is this code correct".

Again, I'm sorry to see that you gave up. Still, I can't do anything against the lack of willing to learn. And mind, I'm more sorry for the fact that you're not learning than for anything.
And now I'll stop, otherwise I could start to act as an angry old coot.


T.

nabil torjemen

unread,
Mar 5, 2015, 4:38:42 PM3/5/15
to ns-3-...@googlegroups.com
Hi,
The main problem is that I'm trying to learn the Object Orienting Programing and ns-3 at the same time.
I'm not lazy and I have try to understand how to do. I have read the ns-3 tutorial and try to understand but I find that I can't do thing correctly. It is not a problem of time and I'm able to spend more time to learn and learn again.
But if I see that I'm not in progress and I'm doing wrong thing without any tuto and person to give me guidlines. I will spend all my life without progress in the right way.

Regading the specific case:
1- I'm reading the mesh and read the comment, tuto,.. But I can't find how they set a specific node as root. It is not even specified in the example which is the root node.
    I see that only mac adress is set and check if it is a brodcast adress to set the stackinstaller but for which node ???? node 1, 2 ,3 which one.
2- Regarding the part of frequency: it is very easy. Currently, in the market some vendors proposes a dual band mesh AP . the first interface using 5 GHz is used for mesh network and to create a wirless bacbone. In the other hand, the second interface using 2.4 GHz is used as an AP for user.

Finally, I will try again and ask the correct question: how can I learn as a beginner on Object Orienting Programing and ns-3 .

Best regards.

Tommaso Pecorella

unread,
Mar 5, 2015, 5:36:45 PM3/5/15
to ns-3-...@googlegroups.com
Ok, that's a better attitude.

I owe him a beer or two for this suggestion. Read it, and you'll learn Design Patterns (it's useful for ns-3) and OOP.
When you have a decent understanding of OOP and Design Patterns, ns-3 will seems much easier.
Learning ns-3 *and* OOP, or learning OOP by using ns-3 may be overwhelming.
Suggestion: get at least some basics of OOP before reading ns-3 code. Classes, inheritance, public/private stuff, virtual classes and functions. Then read ns-3. If you find something very strange, 95% of the time it's a Design Pattern. The other 5% is just bad programming.

Specific case: the root node. Check the mesh example in "src/mesh/examples/mesh.cc". The root is set through the following code:
  mesh = MeshHelper::Default ();

 
if (!Mac48Address (m_root.c_str ()).IsBroadcast ())
   
{
      mesh
.SetStackInstaller (m_stack, "Root", Mac48AddressValue (Mac48Address (m_root.c_str ())));
   
}
 
else
   
{
     
//If root is not set, we do not use "Root" attribute, because it
     
//is specified only for 11s
      mesh
.SetStackInstaller (m_stack);
   
}

where m_stack is a string (e.g., "ns3::Dot11sStack") and m_root is the MAC of the root MeshPointDevice. The right question is: how to find out that MAC address.
The only way (sadly) is to count them. Consider that MAC addresses are assigned sequentially. Moreover, in the helper it's stated "// Mesh point has MAC address of it's first interface".
As a consequence, suppose you have 5 nodes, each with a MeshPointDevice with only ONE interface, the first will have a "00:00:00:00:00:01" address, the second "00:00:00:00:00:02" and so on.
If the same nodes have a MeshPointDevice with TWO interfaces, their MAC will be "00:00:00:00:00:01", "00:00:00:00:00:03", etc.

Got now ?

About the standards, again, check the helper.
void
MeshHelper::SetStandard (enum WifiPhyStandard standard)
{
  m_standard
= standard;
}

and m_standard is used in...
Ptr<WifiNetDevice>
MeshHelper::CreateInterface (const WifiPhyHelper &phyHelper, Ptr<Node> node, uint16_t channelId) const

With a little more effort, you could have found that THIS is the function to call to setup the standard in the mesh. As a consequence, you first create the helper, then you set the mesh type and the root, then you can write
  mesh.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);

About setting up the AP in the same node (and the wifi clients) that's done in a totally different way.

My suggestion at this point is: try to setup the mesh backbone. Once that's up and running, you'll add the rest. If you do everything at once it won't work (and you'll not know why).

And don't forget to read that book (or any other good book).

Cheers,

T.

nabil torjemen

unread,
Mar 8, 2015, 8:51:54 AM3/8/15
to ns-3-...@googlegroups.com
Hi,
Thanks for your response.
I will sure get the book and read it.
Regarding the root node, the problem was that i'm using a modified mesh directory that's why I got error using mesh.SetStackInstaller (m_stack, "Root", Mac48AddressValue (Mac48Address (m_root.c_str ())));

Now I'm using the mesh directory provided in the ns3.22 package and it work fine.
so just only set the m_root paramter to the MAC adress of the desired node. In fact, when I check the output file I see that Isroot is set to 1 for this node.

Now as the mesh part is working fine, I will try to setup the AP part.
I will also to see some video related to Design Patterns.
Br.

nabil torjemen

unread,
Mar 17, 2015, 12:18:53 PM3/17/15
to ns-3-...@googlegroups.com
Hi Tommaso;
I'm reading the recommended book. I have already read around 60% of it. It is good but hard to use for beginner.
I'm trying to progress.


However, I still try to set up the configuration. In your last message, you have write:

About setting up the AP in the same node (and the wifi clients) that's done in a totally different way.

My suggestion at this point is: try to setup the mesh backbone. Once that's up and running, you'll add the rest. If you do everything at once it won't work (and you'll not know why).

I have proposed the following code:
        /*
         create the mesh part
        */

        mesh_nodes
.Create (6); // Create 6 nodes mesh  
       
       
// Configure YansWifiChannel
   
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
   
YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
    wifiPhy
.SetChannel (wifiChannel.Create ());

   
/*
     * Create mesh helper and set stack installer to it
     * Stack installer creates all needed protocols and install them to
     * mesh point device
     */

    mesh
= MeshHelper::Default ();
               
   
if (!Mac48Address (m_root.c_str ()).IsBroadcast())
           
{
                 mesh
.SetStackInstaller (m_stack, "Root", Mac48AddressValue (Mac48Address (m_root.c_str ())));
           
}
       
else
           
{
               
//If root is not set, we do not use "Root" attribute, because it
               
//is specified only for 11s
                mesh
.SetStackInstaller (m_stack);
           
}

       
if (m_chan)
         
{
            mesh
.SetSpreadInterfaceChannels (MeshHelper::SPREAD_CHANNELS);
         
}
       
else
         
{
            mesh
.SetSpreadInterfaceChannels (MeshHelper::ZERO_CHANNEL);
         
}

       
        mesh
.SetMacType ("RandomStart", TimeValue (Seconds (m_randomStart)));
   
       
// Set number of interfaces for mesh node
    mesh
.SetNumberOfInterfaces (m_nIfaces);
           
   
// set mesh standard
        mesh
.SetStandard(WIFI_PHY_STANDARD_80211n_5GHZ);

       
       
// Install protocols and return container if default MeshPointDevices
        mesh_NetDevices
= mesh.Install (wifiPhy, mesh_nodes);      
         
       
       
// Setup mobility - static topology for default AP
   
MobilityHelper mobility;
   
Ptr<ListPositionAllocator> positionAlloc =
               
CreateObject<ListPositionAllocator>();
    positionAlloc
->Add (Vector (330.0, 380.0, 0.0));// AP in Building 1
        positionAlloc
->Add (Vector (500.0, 300.0, 0.0));// AP in Building 2
    positionAlloc
->Add (Vector (740.0, 350.0, 0.0));// AP in Building 3
    positionAlloc
->Add (Vector (250.0, 800.0, 0.0));// AP in Building 4 : the root node
        positionAlloc
->Add (Vector (500.0, 740.0, 0.0));// AP in Building 5
    positionAlloc
->Add (Vector (720.0, 720.0, 0.0));// AP in Building 6
    mobility
.SetPositionAllocator (positionAlloc);
    mobility
.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
        mobility
.Install (mesh_nodes);

       
       
// create the wifi part

                   
       
// Create 7 nodes wifi      
        wifi_AP_nodes
.Add(mesh_nodes);// create 6 AP
        wifi_AP_nodes
.Create (1); // add the second node in building 1

        mobility
.Install (wifi_AP_nodes.Get(6));

       
       
// Create wifi helper and set the wifi frequence at 2.4 GHz
        wifi
.SetStandard(WIFI_PHY_STANDARD_80211n_2_4GHZ);

           
       
QosWifiMacHelper mac = QosWifiMacHelper::Default();  
        wifi
.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                     
"DataMode", StringValue ("OfdmRate54Mbps"));
             
       
Ssid ssid = Ssid ("ns-3-ssid");

        mac
.SetType ("ns3::ApWifiMac",
               
"Ssid", SsidValue (ssid),
               
"BeaconGeneration", BooleanValue (true),
               
"BeaconInterval", TimeValue (Seconds (5)));
     
       
        wifi_AP_NetDevices
= wifi.Install (wifiPhy, mac, wifi_AP_nodes);


This code does not return any errors and it seems working well. The next step is to configure P2P link between the AP node and the Mesh Node.
However, I really appreciate if you can recommend any best approach. I will try to learn about it and change my code according to it.
Best regards.
 

mesh_configuration.bmp

shivam patel

unread,
Nov 19, 2015, 3:41:40 PM11/19/15
to ns-3-users
 if (!Mac48Address (m_root.c_str ()).IsBroadcast ())
    
{
      mesh
.SetStackInstaller (m_stack, "Root", Mac48AddressValue (Mac48Address (m_root.c_str ())));
    
}
In this example Why they are using m_root that is assigned a broadcast address?

Tommaso Pecorella

unread,
Nov 19, 2015, 4:34:03 PM11/19/15
to ns-3-users
It's the opposite... set the root if the root address is NOT a broadcast. You missed a "!".

T.

shivam patel

unread,
Nov 21, 2015, 9:17:33 AM11/21/15
to ns-3-users
After Understanding HWMP am running that mesh.cc and visualising it using pyVIZ am unble to understand whats going...its nothing like how protocol work.
 
step_100_1.png
step_100_2.png
step_100_3.png

Tommaso Pecorella

unread,
Nov 21, 2015, 9:27:26 AM11/21/15
to ns-3-users
Hi,

mind to explain what's the problem ?
In particular, what is the expected output and why are you thinking that this isn't hw protocol works ?

T.
Reply all
Reply to author
Forward
0 new messages