Install a Ns2Mobility in two node containers

60 views
Skip to first unread message

Albert Smith

unread,
Mar 16, 2017, 7:39:40 AM3/16/17
to ns-3-users
Hi everyone,

I'm working with ns3 3.21.

I know how to install a Ns2Mobility in a node container:

NodeContainer nodes;

/*...*/

Ns2MobilityHelper ns2 = Ns2MobilityHelper ("rpgm.ns_movements");
nodes
.Install (nodes.Begin(),nodes.End());

Where, the number of nodes in the container is the same that in the bonnmotion file generated.

My doubt is, is it possible to install that mobility model in two different containers? Suppose, a container with X nodes, another container with Y nodes and a bonnmotion file generated with X+Y nodes. 

NodeContainer nodes_X;
NodeContainer nodes_Y;
/*...*/

Ns2MobilityHelper ns2 = Ns2MobilityHelper ("rpgmX+Y.ns_movements");
//Here is the problem, how to install on both, i.e., iterate over the two containers.
/*nodes.Install (nodes.Begin(),nodes.End());*/

Thank you in advance.
Message has been deleted

Albert Smith

unread,
Mar 16, 2017, 9:01:41 AM3/16/17
to ns-3-users
Ok. I finally get it. I post the solution, just in case someone will found it useful in the future. 

You can do a new container, mergin the two containers, install the mobility in the unified container and after use the individual containers as usual.

NodeContainer nodes_X;
NodeContainer nodes_Y;

/*...*/

Ns2MobilityHelper ns2 = Ns2MobilityHelper ("rpgmX+Y.ns_movements");
NodeContainer unified_nodes(nodes_X, nodes_Y);
ns2.Install (unified_nodes.Begin(),unified_nodes.End());

//Continue configuring nodes_X...
//Continue configuring nodes_Y...
Reply all
Reply to author
Forward
0 new messages