Re: [ns] install ns2.29.3 in ubuntu 8.04, please help me
Il 20/11/2010 20:17, Wei Zhang ha scritto: Hi All, I install ns2.29.3 in ubuntu 8.04 as follows: 1) run # sudo apt-get install build-essential # sudo apt-get install tcl8.4 tcl8.4-dev tk8.4 tk8.4-dev # sudo apt-get install libxmu-dev libxmu-headers 2) ./install 3) in ./bashrc file i add: export PATH=$PATH:/home/wei/ns-allinone 2.29/bin:/home/wei/ns-allinone-2.29/tcl8.4.11/unix:/home/wei/ns-allinone-2.29/tk8.4.11/unix export TCL_LIBRARY=$TCL_LIBRARY:/home/wei/ns-allinone-2.29/tcl8.4.11/library export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/wei/ns-allinone-2.29/otcl-1.11:/home/wei/ns-allinone-2.29/lib when i run ns-allinone2.29/ns2.29/tcl/ex$ ns simple.tcl It has an error: Namesever not reachable simple.tcl NS record not found (I checked simple.tcl file is always in ns-allinone2.29/ns2.29/tcl/ex) Could anybody please help me soon? Thank you in advance. Wei In your $PATH some command called ns is found before the one of NS2. You should either remove ns in the system, which btw is not necessary (type whereis ns to find it) or do something like: export PATH=/home/wei/ns-allinone 2.29/bin:/home/wei/ns-allinone-2.29/tcl8.4.11/unix:/home/wei/ns-allinone-2.29/tk8.4.11/unix:$PATH so that you ns comes before. You can always cd into ns folder and execute it direclty with ./ns Bye.
[ns] used the Error model for Bit Error rate in NS-2.34 - getting confused results
Dear All, I am trying to use the Error model for Bit Error rate in NS-2.34. So i inserted the code:- $ns_ node-config -IncomingErrProc UniformErr -OutgoingErrProc UniformErr proc UniformErr {} { set err [new ErrorModel] $err unit bit $err set rate_ 0.0005 return $err } But the problem is that most of my packets are dropped and i dont know why for the 14990 cbr sent packet 14926 packet dropped. Although i changed the error rate several times but the packet drop remains same. I have inserted some print command inside the errormodel.cc to see the outputs but i saw that within errormodel.cc the datapktsize_ and cntrlpktsize_ NS-2 use a different number Doesn't use the packet size which i am giving sometimes 0 or sometimes very big number 8980976 or higher than this. May be its using the pointer address. I have given the errmodel.cc code after my TcL script. After seeing the output i am totally confused. Is there anyone who has done simulation for Bit error rate in NS-2 and give me suggestions or provide code or just mark my mistakes. the full code is given below: ** # == # 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) 5000 ;# max packet in ifq set val(nn) 2 ;# number of mobilenodes set val(rp) AODV ;# routing protocol # == # Main Program # == ns-random 0 # # Initialize Global Variables # set ns_ [new Simulator] set tracefd [open simple.tr w] $ns_ trace-all $tracefd # set up topography object set topo [new Topography] $topo load_flatgrid 500 500 # # Create God # create-god $val(nn) # # Create the specified number of mobilenodes [$val(nn)] and attach them # to the channel. # Here two nodes are created : node(0) and node(1) # configure node $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 OFF $ns_ node-config -IncomingErrProc UniformErr -OutgoingErrProc UniformErr proc UniformErr {} { set err [new ErrorModel] $err unit bit $err set rate_ 0.0005 return $err } for {set i 0} {$i $val(nn) } {incr i} { set node_($i) [$ns_ node] $node_($i) random-motion 0 ;# disable random motion } # # Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes # $node_(0) set X_ 5.0 $node_(0) set Y_ 2.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 150.0 $node_(1) set Y_ 150.0 $node_(1) set Z_ 0.0 # # Now produce some simple node movements # Node_(1) starts to move towards node_(0) # #$ns_ at 50.0 $node_(1) setdest 25.0 20.0 15.0 #$ns_ at 10.0 $node_(0) setdest 20.0 18.0 1.0 # Node_(1) then starts to move away from node_(0) #$ns_ at 100.0 $node_(1) setdest 490.0 480.0 15.0 # Setup traffic flow between nodes #Create a UDP agent and attach it to node node_(0) set udp0 [new Agent/UDP] $ns_ attach-agent $node_(0) $udp0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 100 $cbr0 set interval_ 0.01 $cbr0 attach-agent $udp0 set null0 [new Agent/Null] $ns_ attach-agent $node_(1) $null0 $ns_ connect $udp0 $null0 $ns_ at 0.1 $cbr0 start # # Tell nodes when the simulation ends # for {set i 0} {$i $val(nn) } {incr i} { $ns_ at 150.0 $node_($i) reset; } $ns_ at 150.0 stop $ns_ at 150.01 puts \NS EXITING...\ ; $ns_ halt proc stop {} { global ns_ tracefd $ns_ flush-trace close $tracefd } puts Starting Simulation... $ns_ run
Re: [ns] Altering Packet Data
Hello, I want to change the data field of Packet p. I get it through userdata(), as follows. But after updating, how to set it back? PacketData* data = (PacketData*)p-userdata(); Thank you, Dhara Buch