I think its possible, you know that there are a header file *.h and an implementation file *.cc and *.tcl for configuration simulation file
in C++ code use: Tcl& tcl = Tcl::instance(); tcl.evalc("Any statement written in you TCL configuration file"); const char* tmp = tcl.resultf() ; int NewVariable= atoi(tmp); in your tcl file use: Any statement written in you TCL configuration file 'number' For further informations, See: http://nile.wpi.edu/NS/linkage.html http://140.127.22.90/index.files/Subject/Tong(90-2)--Performance_of_system/Chapter%203%20%20Otcl%20Linkage.ppt Cheers, Mohammed AbuHajar leticia bela <[EMAIL PROTECTED]> wrote: Thanks for your response, I have not problem to generate a traffic file. My problem is how can i change the value of a rate for a given source during simulation from my c++ file. thanks again Mohammed Abu Hajar <[EMAIL PROTECTED]> a écrit : Creating random traffic-pattern for wireless scenarios Random traffic connections of TCP and CBR (Constant Bit Rate) can be setup between mobile nodes using a traffic scenario generator script. This traffic generator script is available under ~/ns-2.28/indep-utils/cmu-scen-gen and is called cbrgen.tcl. The command line looks like the following: ns cbrgen.tcl [-type cbr|tcp] [-nn nodes] [-seed seed] [-mc connections] [-rate rate] -type cbr|tcp Type of the generated traffic, TCP or CBR -nn nodes Total number of nodes being simulated -seed seed Random number seed used to initialize part of the seed of various randomly generated numbers in the simulation. This can be used to vary the seed of the simulation to see the consistency of the results of the simulation -mc connections Number of flow connections -rate rate Number of packets per second. cbr gensub-command explanation The start times for the TCP/CBR connections are randomly generated with a maximum value set at 180.0s, thus the simulation time is at least 180 seconds, and the number of nodes has no relationship to the maximum number of connections. A typical generated CBR traffic file looks like: set udp_(1) [new Agent/UDP] $ns_ attach-agent $node_(4) $udp_(1) set null_(1) [new Agent/Null] $ns_ attach-agent $node_(5) $null_(1) set cbr_(1) [new Application/Traffic/CBR] $udp_(1) set fid_ 1 $cbr_(1) set packetSize_ 512 $cbr_(1) set interval_ 0.25 $cbr_(1) set random_ 1 $cbr_(1) set maxpkts_ 10000 $cbr_(1) attach-agent $udp_(1) $ns_ connect $udp_(1) $null_(1) $ns_ at 56.333118917575632 "$cbr_(1) start" A typical generated TCP (FTP) traffic file looks like: set tcp_(0) [ new Agent/TCP ] set sink_(0) [ new Agent/TCPSink ] set ftp_(0) [ new Application/FTP ] $tcp_(0) set class_ 1 $tcp_(0) set packetSize_ 512 $ns_ attach-agent $node_(1) $tcp_(0) $ns_ attach-agent $node_(2) $sink_(0) $ftp_(0) attach-agent $tcp_(0) $ns_ connect $tcp_(0) $sink_(0) $ns_ at 2.5568388786897245 "$ftp_(0) start" $ns_ at $val(stop) "$ftp_(0) stop" If you want to change the values you can use awk script to do that. Regards, Mohammed AbuHajar MSc of Computer Science leticia bela <[EMAIL PROTECTED]> wrote: Hi, Please can any one say me how can i change cbr rate during simulation for a given resource from my c++ file. or there are not solution for this ??????????????? thanks a lot!!! --------------------------------- Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail --------------------------------- Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how. --------------------------------- Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail --------------------------------- Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.