Ns2MobilityHelper with SUMO

137 views
Skip to first unread message

Ricardo

unread,
Jan 18, 2015, 4:03:11 AM1/18/15
to ns-3-...@googlegroups.com
Hi,

I created a map, and then generated vehicle flow in it using SUMO. I use flows, so every x seconds a new vehicle is created.

It works fine in NS3, there's just one issue: ns3 creates ALL the vehicles at the very beginning, the ones that should be generated x second intervals are there too, they don't move but they are listening and in my case, sending HELLOs.

So, instead just one vehicle working at the beginning, in this case there are 10 (I generate 1 vehicle per minute 10 times), the other 9 are in the initial position but they're interacting with each other and the valid vehicle.

Is there any way to prevent this issue to happen?

Thanks.

Konstantinos

unread,
Jan 18, 2015, 4:51:12 AM1/18/15
to ns-3-...@googlegroups.com
Hi Riccardo,

No, you can not prevent that from happening. In NS-3 you can not create nodes dynamically, you have to have them all initiated at the beginning of simulation.
However, you could make them unable to communicate (e.g. disable their interfaces) and then at the moment you want to enter the simulation enable them.

e.g. use the SetDown() and SetUp() methods 
K.

Ricardo

unread,
Jan 19, 2015, 3:26:03 PM1/19/15
to ns-3-...@googlegroups.com
Hi Konstantinos,

Thank you for the quick answer. I'll use that.

Patrick D

unread,
Jan 20, 2015, 11:35:37 AM1/20/15
to ns-3-...@googlegroups.com
Super reply, I recently pointed out to a colleague this uniqueness and how it will affect his simulation but unfortunately could not give a proper solution to it, thanks for this.
Should have known or remembered from Cisco interfaces (setting up and down).

Ricardo

unread,
Jan 26, 2015, 2:25:02 PM1/26/15
to ns-3-...@googlegroups.com
Hi Konstantinos,

I have a question. Are the nodes in ns3 assigned with the mobility in the mobility trace (.mob.tcl) in an orderly manner?

For instance this piece of trace:

$node_(0) set X_ 1367.51
$node_(0) set Y_ -2.85
$node_(0) set Z_ 0
$ns_ at 0.0 "$node_(0) setdest 1367.51 -2.85 0.00"
$node_(1) set X_ 2370.72
$node_(1) set Y_ 4994.33
$node_(1) set Z_ 0
$ns_ at 0.0 "$node_(1) setdest 2370.72 4994.33 0.00"
$node_(2) set X_ 3947.04
$node_(2) set Y_ 4997.47
$node_(2) set Z_ 0
$ns_ at 0.0 "$node_(2) setdest 3947.04 4997.47 0.00"
$node_(3) set X_ 5.75
$node_(3) set Y_ 995.82
$node_(3) set Z_ 0

The node 0 in ns3 (NodeContainer with index 0) will have the mobility of $node_(0) in the trace, the node with index 1 will have the mobility of $node_(0), and so on.

NodeContainer nodes;
nodes.Get (0) = $node_(0)
nodes.Get (1) = $node_(1)
nodes.Get (2) = $node_(2)
...

I want to know this so I can set timers to SetUp and SetDown the nodes in the times they enter or leave the simulation.

Thanks :)

Ricardo

unread,
Jan 26, 2015, 5:04:50 PM1/26/15
to ns-3-...@googlegroups.com
Correcting something I wrote wrong.

The node 0 in ns3 (NodeContainer with index 0) will have the mobility of $node_(0) in the trace, the node with index 1 will have the mobility of $node_(1), and so on.

I wrote $node_(0) instead of $node_(1).

Konstantinos

unread,
Jan 26, 2015, 5:11:43 PM1/26/15
to ns-3-...@googlegroups.com
Yes, $node_(0) in the ns-2 mobility file, corresponds to node_0 in the NodeList of ns3.

Ricardo

unread,
Jan 26, 2015, 5:23:01 PM1/26/15
to ns-3-...@googlegroups.com
Thank you very much :)
Reply all
Reply to author
Forward
0 new messages