Hello Kavan, I think this might help, I will try it soon.
Thanks :D Mathiew Quoting kavan sheth <[email protected]>: > Hi mathiew, > > in the static configuration we start cbr traffic using tcl commands. > > set udp_(0) [new Agent/UDP] > $ns_ attach-agent $node_(2) $udp_(0) > set null_(0) [new Agent/Null] > $ns_ attach-agent $node_(3) $null_(0) > set cbr_(0) [new Application/Traffic/CBR] > $cbr_(0) set packetSize_ 512 > $cbr_(0) set interval_ 0.25 > $cbr_(0) set random_ 1 > $cbr_(0) set maxpkts_ 10000 > $cbr_(0) attach-agent $udp_(0) > $ns_ connect $udp_(0) $null_(0) > $ns_ at 82.557023746220864 "$cbr_(0) start" > > > > So what you can do is execute this tcl statements dynamically from you c++ > code using any of the following two ways > (following are just example of how to run tcl command from your c++ code. > for more deail refer section 3.3 of ns) > sprintf(tcl.buffer(), "Agent/SRM set requestFunction_ %s", "Fixed"); > tcl.eval(); > OR > tcl.evalf("%s request %d %d", name_, sender, msgid); > > hope this will help!! (I am not sure, but I think this will work) > > regards, > Kavan Sheth > DA-IICT > India > > On Mon, Jun 1, 2009 at 7:56 PM, Mathiew Moussa <[email protected]> wrote: > >> >> Hi All, >> >> I am implementing a clustering algorithm for WSNs and I'm constructing >> the clusters in C++. >> >> The clustering phase is done in the beginning of the simulation for >> about 3seconds after which i need to assign connections between the >> cluster members and cluster heads based on the results of the cluster >> algorithm, therefore assign the necessary cbr connections only. >> >> How can i do this dynamically, therefore how can i tell the nodes in a >> cluster to open a cbr connection with only their cluster head >> (considering the nodes already know the cluster head they need to bind >> too in C++). >> >> Can this be done in TCL. >> >> Your Help is greatly appreciated. >> Thanks. >> >> Mathiew >> >> >
