[ns] How to get the Nodes' coordinate from TCL to C++
Dear NS Users, Can someone please tell me how you can retrieve the coordinates of the network nodes from a TCL file into C++. So is their some loop or something that can be written in C++ and traverses all the nodes and gets X, Y, Z, and how is it written. Hope you can help me. Thanks, Mathiew
[ns] NAM don't update the mobile node movement's starting position
Hi I am using NAM to show the mobile node movement in ns2.33. NAM is showing the moving nodes, but another initial image of the node is also kept in the screen. can anybody tell me why? and some of the nodes are sometimes shown in ash color, not in the default color black. If you know why and how can I solve it, please let me know. attached is a snapshot of nam. link - http://folk.ntnu.no/ashraful/file/ns/nam-screen.jpg brmany many thanks in advance. - Ashraf
Re: [ns] Setting tcl script variables from inside C++ code
Hello Fernando, You can use the following code: Tcl tcl = Tcl::instance(); sprintf(tcl.buffer(), set my_tcl_var %f, 10.123); tcl.eval(); Note that you can use the same method to execute any command on Tcl. You can find more information in chapter 3 of the ns-manual. Good luck Waleed On Tue, Jan 20, 2009 at 3:09 PM, fh...@c3sl.ufpr.br wrote: Well, it is just as the title says: I would like to know how to change the value of my tcl script variables from inside my C++ code. I learned how to change C++ variables from inside the tcl code, but not the tcl variables from inside the C++ code. Is there any easy way? Thanks in advance, -- Fernando Henrique Gielow - UFPR - NR2 Computer Science graduation student.
Re: [ns] example on aodv simulation
Hi Samar asf, You can use the following code to run a simple example of aodv. # A 3-node example for ad-hoc simulation with AODV # Define options set val(chan) Channel/WirelessChannel;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy;# network interface type set val(mac)Mac/802_11 ;# MAC type set val(ifq)Queue/DropTail/PriQueue;# interface queue type set val(ll) LL ;# link layer type set val(ant)Antenna/OmniAntenna;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 3 ;# number of mobilenodes set val(rp) AODV ;# routing protocol set val(x) 500 ;# X dimension of topography set val(y) 400 ;# Y dimension of topography set val(stop)150 ;# time of simulation end set ns [new Simulator] set tracefd [open simple.tr w] set windowVsTime2 [open win.tr w] set namtrace [open simwrls.nam w] $ns trace-all $tracefd $ns namtrace-all-wireless $namtrace $val(x) $val(y) # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) create-god $val(nn) # # Create nn mobilenodes [$val(nn)] and attach them to the channel. # # configure the nodes $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -channelType $val(chan) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace ON for {set i 0} {$i $val(nn) } { incr i } { set node_($i) [$ns node] } # Provide initial location of mobilenodes $node_(0) set X_ 5.0 $node_(0) set Y_ 5.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 490.0 $node_(1) set Y_ 285.0 $node_(1) set Z_ 0.0 $node_(2) set X_ 150.0 $node_(2) set Y_ 240.0 $node_(2) set Z_ 0.0 # Generation of movements $ns at 10.0 $node_(0) setdest 250.0 250.0 3.0 $ns at 15.0 $node_(1) setdest 45.0 285.0 5.0 $ns at 110.0 $node_(0) setdest 480.0 300.0 5.0 # Set a TCP connection between node_(0) and node_(1) set tcp [new Agent/TCP/Newreno] $tcp set class_ 2 set sink [new Agent/TCPSink] $ns attach-agent $node_(0) $tcp $ns attach-agent $node_(1) $sink $ns connect $tcp $sink set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 10.0 $ftp start # Printing the window size proc plotWindow {tcpSource file} { global ns set time 0.01 set now [$ns now] set cwnd [$tcpSource set cwnd_] puts $file $now $cwnd $ns at [expr $now+$time] plotWindow $tcpSource $file } $ns at 10.1 plotWindow $tcp $windowVsTime2 # Define node initial position in nam for {set i 0} {$i $val(nn)} { incr i } { # 30 defines the node size for nam $ns initial_node_pos $node_($i) 30 } # Telling nodes when the simulation ends for {set i 0} {$i $val(nn) } { incr i } { $ns at $val(stop) $node_($i) reset; } # ending nam and the simulation $ns at $val(stop) $ns nam-end-wireless $val(stop) $ns at $val(stop) stop $ns at 150.01 puts \end simulation\ ; $ns halt proc stop {} { global ns tracefd namtrace $ns flush-trace close $tracefd close $namtrace } $ns run === Regards Mubashir Husain Rehmani Lip6, UPMC, Paris, France www-npa.lip6.fr/~rehmani 2009/1/22 samar asf sam...@mail2song.com Hi I sent this message previously but no answer please reply me becuase i need it soon. where can i found my question and the replies. (I am beginner in ns2, and i want to learn it quickly because i need it in my project. so i want to guide me what topices must i start reading? and i want to know the steps to run any example in ns2 under windows xp sp2. i want to know how to run aodv example , and show how it work in ns2 ,because my project is to adjust some feauters in aodv protocol. please help me and reply me soon because i need it quickly. thanks very much.) span id=m2wTlpfont face=Arial, Helvetica, sans-serif size=2 style=font-size:13.5px___BRGet the Free email that has everyone talking at a href= http://www.mail2world.com target=newhttp://www.mail2world.com/abr font color=#99Unlimited Email Storage #150; POP3 #150; Calendar #150; SMS #150; Translator #150; Much More!/font/font/span -- Mubashir Husain Rehmani
Re: [ns] How to get the Nodes' coordinate from TCL to C++
Hello Walid, Thanks for the reply. You said getting the coordinates from the TCL file easier... i have them stored in a topography.tcl file (or so i recall) that has the X Y Z coordinates of each sensor. So what's the way to get them from the TCL file directly to be used in C++ ?? Thanks alot, Mathiew Quoting Waleed Tuffaha tuff...@gmail.com: Hello Mathiew, ( Note that I didn't test this ! ) The Node class uses a Location class in which the X,Y,Z variables are defined. The mobilenode class inherits from the node class. So, if node_ is a pointer to a mobilenode, then you should be able to get the coordinates using: int x,y,z; node_-location_-getLocation(x, y, z) So if you have an array containing pointers to all the nodes then you can loop on the array and get the coordinates for each node. I think that getting the coordinates from Tcl is easier, but I don't know what exactly you are doing. Hope this helps -- Waleed On Thu, Jan 22, 2009 at 9:59 AM, Mathiew Moussa mm...@aub.edu.lb wrote: Dear NS Users, Can someone please tell me how you can retrieve the coordinates of the network nodes from a TCL file into C++. So is their some loop or something that can be written in C++ and traverses all the nodes and gets X, Y, Z, and how is it written. Hope you can help me. Thanks, Mathiew
[ns] Fw: Cbr traffic use in Tcp or not for MAODV
--- On Mon, 19/1/09, vaishali mandhare v_mandh...@yahoo.com wrote: From: vaishali mandhare v_mandh...@yahoo.com Subject: Fw: Cbr traffic use in Tcp or not for MAODV To: ns user ns-users@isi.edu Date: Monday, 19 January, 2009, 9:16 PM --- On Mon, 19/1/09, vaishali mandhare v_mandh...@yahoo.com wrote: From: vaishali mandhare v_mandh...@yahoo.com Subject: Cbr traffic use in Tcp or not for MAODV To: ns user ns-users@isi.edu Date: Monday, 19 January, 2009, 1:24 PM Hello, I am doing performance comparision of tcp and cbr in maodv on ns2.26.Can anybody tell me that cbr traffic is used in tcp script for calculating the parameter packet dilivery ratio and latency.Plz Plz help me Thanks!!! Add more friends to your messenger and enjoy! Invite them now. Add more friends to your messenger and enjoy! Invite them now. Check out the all-new Messenger 9.0! Go to http://in.messenger.yahoo.com/
Re: [ns] How to determine txpower from Pt_
Hello Manish, My understanding is that the two parameters are not related. Pt_ defines the amount of power transmitted from the antenna (Phy/WirelessPhy), and thus; it defines (together with the RXThresh_ parameter) the range of the mobile-node. And it is not used by the energy model. txpower defines how much power a mobile-node, as a whole, consumes when it is transmitting, and it is the one used by the energy model. For example; the PRO/Wireless 3945ABG card on my laptop can consume a maximum power of 1.8 Watt while transmitting and a maximum of 1.4 Watt while receiving. But the maximum transmitting power is 15 dBm ( ~ 31 mW) ! -- Waleed Tuffaha On Wed, Jan 21, 2009 at 7:07 AM, manish chaturvedi msc@gmail.comwrote: Hi, I am trying to incorporate energy model in my NS2.33 simulation. I have some confusion between Pt_(used to set transmission range), and txpower(energy model parameter specifying enegy consumption in transmission). I need to know what is the relation between these values, and how can I calculate one(txpower) given the other(Pt_). I looked at some old discussions on this mailing list but could not make it from there. Please give information or point to some source of this information. Thanking you,Manish.
[ns] NS transmission powers based in tinyOS
In the protocol that I am currently implementing on NS2 the transmission powers does vary a lot. Its initial implemention was done in tinyOS, and that is why I need to simulate its available transmission powers. There is a range of 255 possible ones in tinyOS, and I would like to change the NS variables (Pt_ [Transmit Power], CPThresh_ [Collision Threshold], CSThresh_ [Carrier Sense Power], RXThresh_ [Receive Power Threshold]), so an approximate behavior could be simulated. I do know the power consumption in mA and the Pout in dBm for each one of these 255 possible powers. Is there be any possible way to set the NS variables so that I would manage to reach an approximate behavior to tinyOS? Thanks in advance, -- Fernando Henrique Gielow - UFPR - NR2 Computer Science graduation student.
[ns] How to generate energy traces periodically
Hi, I am using energy model in my NS simulation. When energy trace is ON, every time the node energy changes, the trace is generated. This makes trace file size larger. Is there any way to generate trace of energy status of all nodes at some fixed time or periodically? Please inform or point me to some source of information. Thanking you, Manish
[ns] print messages describing the simulation from the terminal to a text file
Hi all, Can you tell me please how can I print messages written in the terminal window during the simulation , to a text file? Thank you for your help.
[ns] HMIP example
Hi users,, Anybody can send me an example of HMIP, I'm trying to do it, but My script don't do a handoff..,,, My script is: # Main Program proc main {} { global opt ns namtrace tracefd cn_ node_ wtopo source /home/vinicio/ns-allinone-2.31/ns-2.31/tcl/mobility/timer.tcl # Define options 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) 800 ;# X dimension of the topography set opt(y) 800 ;# Y dimension of the topography set opt(ifqlen) 50 ;# max packet in ifq set opt(seed) 0.0 set opt(tr) out.tr;# trace file set opt(nam) out.nam ;# nam trace file set opt(adhocRouting) NOAH set opt(nn) 3 ;# how many nodes are simulated set opt(stop) 55.0 ;# simulation time set ns [new Simulator] set tracefd [open $opt(tr) w] $ns trace-all $tracefd set namtrace[open $opt(nam) w] $ns namtrace-all $namtrace $ns color 1 red create-my-topo log-mn-movement_no_topo set-cbr $ns at $opt(stop) finish $ns run } Topologia ## proc create-my-topo {} { global ns opt wtopo node_ cn_ set wtopo [new Topography] $wtopo load_flatgrid $opt(x) $opt(y) set num_wired_nodes 2 set num_bs_nodes 2 set num_wireless_nodes 1 Agent/MIPMH set reg_rtx_ 1.0 $ns set-address-format hierarchical Simulator set mobile_ip_ 1 set HFA_Routing 1 AddrParams set domain_num_ 2 lappend cluster_num 1 3 AddrParams set cluster_num_ $cluster_num lappend eilastlevel 1 1 2 1; AddrParams set nodes_num_ $eilastlevel set cn_ [$ns node 0.0.0] $cn_ set X_ 400.0 $cn_ set Y_ 400.0 $cn_ set Z_ 0.0 $ns initial_node_pos $cn_ 10 set router [$ns node 1.0.0] $router set X_ 400.0 $router set Y_ 300.0 $router set Z_ 0.0 $ns initial_node_pos $router 10 $ns node-config -adhocRouting $opt(adhocRouting) \ -mobileIP ON \ -addressType hierarchical \ -llType $opt(ll) \ -macType $opt(mac) \ -ifqType $opt(ifq) \ -ifqLen $opt(ifqlen) \ -antType $opt(ant) \ -propType $opt(prop) \ -phyType $opt(netif) \ -channelType $opt(chan) \ -topoInstance $wtopo \ -wiredRouting ON \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF source /home/vinicio/ns-allinone-2.31/ns-2.31/tcl/cims/hfa-lib_ns-2.26.tcl Simulator set node_factory_ MobileNode/GFA Simulator set EnableHierRT_ 1 set god_ [create-god $opt(nn)] set gma1 [$ns node 1.1.0] $gma1 set X_ 200.0 $gma1 set Y_ 200.0 $gma1 set Z_ 0.0 $ns initial_node_pos $gma1 10 makeHfaBS $gma1 set gma2 [$ns node 1.2.0] $gma2 set X_ 600.0 $gma2 set Y_ 200.0 $gma2 set Z_ 0.0 $ns initial_node_pos $gma2 10 makeHfaBS $gma2 createAddrTable $cn_ createAddrTable $router set BS1address [AddrParams set-hieraddr [$gma1 node-addr]] $ns node-config -wiredRouting OFF; set node_(3) [$ns node 1.1.1] $node_(3) set X_ 200.0 $node_(3) set Y_ 100.0 $node_(3) set Z_ 0.0 set GFAaddress [AddrParams set-hieraddr [$node_(3) node-addr]] makeHfaMH $node_(3) $GFAaddress set NumOfHO 110 $ns at 1.0 $node_(3) setdest 600 100 15 $ns duplex-link $cn_ $router 100Mb 2.0ms DropTail $ns duplex-link $router $gma1 100Mb 2.0ms DropTail $ns duplex-link $router $gma2 100Mb 2.0ms DropTail } # proc log-mn-movement_no_topo { } { Class LogTimer -superclass Timer LogTimer instproc timeout {} { global node_ logtimer $node_(3) log-movement $self sched 1 } set logtimer [new LogTimer] $logtimer sched 1 } ### proc finish {} { global ns tracefd namtrace opt cn_ node_ puts Simulacion terminada $ns flush-trace flush $tracefd close $tracefd close $namtrace exec nam $opt(nam) exit 0 } ## trafico ## #--- Tráfico desde el CN hacia el MN -- proc set-cbr { } { global ns cn_ node_ udp dst src # CREACIÓN DE UN AGENTE UDP # Nodo fuente set udp [new Agent/UDP] $ns attach-agent $cn_ $udp # Nodo destino set dst [new Agent/Null] $ns attach-agent $node_(3) $dst #Conexión virtual de los nodos fuente y destino $ns connect $udp $dst # Define el color del flujo de datos UDP $udp set fid_ 1 # Configuración del tráfico CBR set src [new Application/Traffic/CBR] $src set packetSize_ 256 $src set rate_ 64000 $src attach-agent $udp # Inicio del tráfico CBR $ns at 3.0 $src start } main or if someone can help and debugg my script I'm thankful Vinicio,.. _ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us
[ns] wireless node
Hi ns-users, I need help, I want use two antennas per node. Can anyone help me? Thanks Avec Voila, réalisez en toute simplicité votre videoblog ! http://video.voila.fr/mktg/?op=videoblog
[ns] Re : print messages describing the simulation from the terminal to a text file
Hi, Thank you for Diana , Félix and moses who gave me the solution of printing messages to a txt file, the solution is: ns name_of_tclFile.tcl file.txt Thanks. --- En date de : Jeu 22.1.09, Nadine Chen nadine...@yahoo.fr a écrit : De: Nadine Chen nadine...@yahoo.fr Objet: [ns] print messages describing the simulation from the terminal to a text file À: ns-users@ISI.EDU Date: Jeudi 22 Janvier 2009, 17h41 Hi all, Can you tell me please how can I print messages written in the terminal window during the simulation , to a text file? Thank you for your help.
[ns] SIMULATION OF COOPERATIVE MAC PROTOCOLS
Hi . I am beginner in ns2, and I want to learn it quickly because I need it in my project. I have to simulate cooperative mac protocols. Has anyone worked on it. If so, please help me. I want to know how to run simple IEEE 802.11b MAC CSMA/CA DCF protocol on ns-2 so that I can start my work. Can anyone please send tcl script for it.Has anyone worked on rDCF,RBAR, COOPMAC protocols on ns-2. If so,please tell me so that I can take your guidance. please help me and reply me soon because i need it quickly. thanks very much.