[ns] How to call variable on mac802.11.cc file to tcl file
Dear All I need to call variable on the mac_802.11.cc in recvdata class to my tcl script to use it on my simulation what shall I do? This is the function I talk about and the variables index_ and ch-qlength_ are the variables I want to recall them on my tcl script on a variable to use there real time variables on my simulation void Mac802_11::recvDATA(Packet *p) { struct hdr_mac802_11 *dh = HDR_MAC802_11(p); u_int32_t dst, src, size; struct hdr_cmn *ch = HDR_CMN(p); dst = ETHER_ADDR(dh-dh_ra); src = ETHER_ADDR(dh-dh_ta); size = ch-size(); /* * Adjust the MAC packet size - ie; strip * off the mac header */ ch-size() -= phymib_.getHdrLen11(); ch-num_forwards() += 1; //to write to a file Tcl tcl = Tcl::instance(); char wrk[100]; if(index_ != 120 || ch-qlength_ / 50.0 = 0.92) { sprintf(wrk, puts \node=%d Q length=%d \ \n, index_, ch-qlength_); tcl.eval(wrk);
[ns] How to take values from file and use it during simulation
Dear All How can i use values of parameters to be saved on a file and i use this parameters while it is saved to make if condition for example and use it on simulation Note: those values are stored and called by cc file not my tcl script BR
[ns] Queue length monitor on wireless medium
Dear All I found someone with a method to monitor queue length on wireless on ns2 but the problem that I can't assign which node number to read the queue length from it so can anybody tell me how to assign the node number to this method and here is the method: 1. Define a variable qlength_ in the common header of the packet: ie add the line int qlength_; in the struct hdr_cmn. 2.In appropriate place in the queue function you are using, eg in the recv() function of prique.cc or in enque() function of drop-tail.cc, read the value of queue length and write it to the above variable qlength_ : ch-qlength_ = q_-length(); before this declare ch as pointer to common header of the packet by: struct hdr_cmn *ch = HDR_CMN(p); 3.Now you can access this variable qlength_ from any other function in the path of the packet. for eg., in the mac-802_11.cc recvDATA() function, add some printf statement to display the value of ch-qlength_ or you can write the value into your output file queue1.tr from mac-802_11.cc recvDATA() function, by adding the following in that function //to write to a file Tcl tcl = Tcl::instance(); char wrk[100]; sprintf(wrk, puts $fp1 \node=%d Q length=%d \ \n, index_, ch-qlength_); tcl.eval(wrk); where fp1 is the pointer to the file queue1.tr. index_ gives the node number set fp1 [open queue1.tr w] #add this line in your tcl file Make the ns before executing BR
[ns] Measure queue length for base station
Dear All Can someone help me and tell me how to measure queue length for base station on ns2 during simulation, I have used the instructions of Smallko and I have failed, can you please help me. BR
[ns] Trace queue length of base station on ns2
Dear All How can i trace the queue length for the base station on ns2 BR
[ns] Measure utilization of access point transmission buffer
Dear All I need to know how can i measure the utilization of access point transmission buffer ,as i am simulating voip in wireless lan 802.11 and i need to measure the utilization of the access point transmission buffer and included in the mail the tcl script i use it. BR
[ns] Measure utilization of access point transmission buffer
Dear All I need to know how can i measure the utilization of access point transmission buffer ,as i am simulating voip in wireless lan 802.11 and i need to measure the utilization of the access point transmission buffer and included in the mail the tcl script i use it. BR
Re: [ns] Measure utilization of access point transmission buffer
Dear All I need to know how can i measure the utilization of access point transmission buffer ,as i am simulating voip in wireless lan 802.11 and i need to measure the utilization of the access point transmission buffer and included in the mail the tcl script i use it. # vim: syntax=tcl # ## # CONFIGURATION OF PARAMETERS # ## # # Simulation environment # set opt(run)0 ;# replic ID set opt(duration) 100.0 ;# run duration, in seconds set opt(warm) 0 ;# run duration, in seconds set opt(out)out ;# statistics output file set opt(debug) ;# debug configuration file, = no debug set opt(startdebug) 100.0 ;# start time of debug output # VoIP modules parameters set opt(aggregate) 1 set opt(tagrand) uniform set opt(tagmean)0.130 set opt(tagvar) 0.01 set opt(tagper) 0 set opt(decoder) optimal #set opt(codec)GSM.AMR ;# G.711, G.723.1, G.729A, GSM.EFR, GSM.AMR, set opt(codec) G.711 ;# G.711, G.723.1, G.729A, GSM.EFR, GSM.AMR, # static decoder parameters set opt(static-buffer) 20 set opt(static-delay) 0.08 global opt set opt(chan) Channel/WirelessChannel set opt(prop) Propagation/TwoRayGround set opt(netif) Phy/WirelessPhy set opt(mac)Mac/802_11 set opt(ifq)Queue/DropTail/PriQueue set opt(ll) LL set opt(ant)Antenna/OmniAntenna set opt(x) 670 set opt(y) 670 set opt(ifqlen) 50 set opt(tr) wired-and-wireless2.tr set opt(namtr) wired-and-wireless2.nam set opt(nn) 120 set opt(rp)DSDV set opt(cp) set opt(sc) ../mobility/scene/scen-3-test set opt(stop) 120 set num_bs_nodes 1 ## # DEFINITION OF PROCEDURES # ## # # parse command-line options_ and store values into the $opt(.) hash # proc getopt {argc argv} { global opt for {set i 0} {$i $argc} {incr i} { set arg [lindex $argv $i] if {[string range $arg 0 0] != -} continue set name [string range $arg 1 end] set opt($name) [lindex $argv [expr $i+1]] } } # # print out options # proc printopt { } { global opt foreach x [lsort [array names opt]] { puts $x = $opt($x) } } # # die function # proc die { x } { puts $x exit 1 } # # alive function # proc alive { } { global ns_ opt if { [$ns_ now] != 0 } { puts -nonewline \ [format elapsed %.0f s (remaining %.0f s) completed %.f%% \ [$ns_ now] \ [expr $opt(duration) - [$ns_ now]] \ [expr 100 * [$ns_ now] / $opt(duration)]] if { [$ns_ now] = $opt(warm) } { puts stat collection ON } else { puts } } $ns_ at [expr [$ns_ now] + $opt(duration) / 10.0] alive } # # collect statistics at the end of the simulation # proc finish {} { global ns_ simtime # print statistics to output file $ns_ stat print # print out the simulation time set simtime [expr [clock seconds] - $simtime] puts run duration: $simtime s exit 0 } # # initialize simulation # proc init {} { global opt defaultRNG ns_ simtime set t 1 set f [expr $opt(nn) + $t] set ns_ [new Simulator] # set up for hierarchical routing $ns_ node-config -addressType hierarchical AddrParams set domain_num_ 1 lappend cluster_num 1 AddrParams set cluster_num_ $cluster_num lappend eilastlevel $f AddrParams set nodes_num_ $eilastlevel # set tracefd [open $opt(tr) w] # $ns_ trace-all $tracefd set namtracefd [open $opt(namtr) w] $ns_ namtrace-all $namtracefd set num_bs_nodes 1 set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y) # god needs to know the number of all wireless interfaces create-god [expr $opt(nn) + $num_bs_nodes] $ns_ node-config -adhocRouting $opt(rp) \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType
Re: [ns] Measure utilization of access point transmission buffer
Dear All I need to know how can i measure the utilization of access point transmission buffer ,as i am simulating voip in wireless lan 802.11 and i need to measure the utilization of the access point transmission buffer and included in the mail the tcl script i use it. # vim: syntax=tcl # ## # CONFIGURATION OF PARAMETERS # ## # # Simulation environment # set opt(run)0 ;# replic ID set opt(duration) 100.0 ;# run duration, in seconds set opt(warm) 0 ;# run duration, in seconds set opt(out)out ;# statistics output file set opt(debug) ;# debug configuration file, = no debug set opt(startdebug) 100.0 ;# start time of debug output # VoIP modules parameters set opt(aggregate) 1 set opt(tagrand) uniform set opt(tagmean)0.130 set opt(tagvar) 0.01 set opt(tagper) 0 set opt(decoder) optimal #set opt(codec)GSM.AMR ;# G.711, G.723.1, G.729A, GSM.EFR, GSM.AMR, set opt(codec) G.711 ;# G.711, G.723.1, G.729A, GSM.EFR, GSM.AMR, # static decoder parameters set opt(static-buffer) 20 set opt(static-delay) 0.08 global opt set opt(chan) Channel/WirelessChannel set opt(prop) Propagation/TwoRayGround set opt(netif) Phy/WirelessPhy set opt(mac)Mac/802_11 set opt(ifq)Queue/DropTail/PriQueue set opt(ll) LL set opt(ant)Antenna/OmniAntenna set opt(x) 670 set opt(y) 670 set opt(ifqlen) 50 set opt(tr) wired-and-wireless2.tr set opt(namtr) wired-and-wireless2.nam set opt(nn) 120 set opt(rp)DSDV set opt(cp) set opt(sc) ../mobility/scene/scen-3-test set opt(stop) 120 set num_bs_nodes 1 ## # DEFINITION OF PROCEDURES # ## # # parse command-line options_ and store values into the $opt(.) hash # proc getopt {argc argv} { global opt for {set i 0} {$i $argc} {incr i} { set arg [lindex $argv $i] if {[string range $arg 0 0] != -} continue set name [string range $arg 1 end] set opt($name) [lindex $argv [expr $i+1]] } } # # print out options # proc printopt { } { global opt foreach x [lsort [array names opt]] { puts $x = $opt($x) } } # # die function # proc die { x } { puts $x exit 1 } # # alive function # proc alive { } { global ns_ opt if { [$ns_ now] != 0 } { puts -nonewline \ [format elapsed %.0f s (remaining %.0f s) completed %.f%% \ [$ns_ now] \ [expr $opt(duration) - [$ns_ now]] \ [expr 100 * [$ns_ now] / $opt(duration)]] if { [$ns_ now] = $opt(warm) } { puts stat collection ON } else { puts } } $ns_ at [expr [$ns_ now] + $opt(duration) / 10.0] alive } # # collect statistics at the end of the simulation # proc finish {} { global ns_ simtime # print statistics to output file $ns_ stat print # print out the simulation time set simtime [expr [clock seconds] - $simtime] puts run duration: $simtime s exit 0 } # # initialize simulation # proc init {} { global opt defaultRNG ns_ simtime set t 1 set f [expr $opt(nn) + $t] set ns_ [new Simulator] # set up for hierarchical routing $ns_ node-config -addressType hierarchical AddrParams set domain_num_ 1 lappend cluster_num 1 AddrParams set cluster_num_ $cluster_num lappend eilastlevel $f AddrParams set nodes_num_ $eilastlevel # set tracefd [open $opt(tr) w] # $ns_ trace-all $tracefd set namtracefd [open $opt(namtr) w] $ns_ namtrace-all $namtracefd set num_bs_nodes 1 set topo [new Topography] $topo load_flatgrid $opt(x) $opt(y) # god needs to know the number of all wireless interfaces create-god [expr $opt(nn) + $num_bs_nodes] $ns_ node-config -adhocRouting $opt(rp) \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType