Re: [ns] Obtaining SNR value
NS2 doesn't simulate SNR, it is based in thresholds. If the signal at the receiver is weaker than CSThresh_ the packet will be discarded at the physical layer, if the signal is weaker than RxThresh_ the packet will be marked as corrupted (error flag = 1) by the physical layer and send to the mac layer. For SNR support in 802.11 check http://www.tlc-networks.polito.it/fiore/ Guillermo Hi, How can I obtain the SNR value at a node during the simulation from the C++ code? I need this to simulate a link adaptation algorithm. TIA, Piyush -- Piyush Agrawal 4th Year Undergraduate Student, Department of Computer Science Engineering, IIT Kanpur, India Homepage: http://www.cse.iitk.ac.in/users/piyushag
Re: [ns] why does the code below doesn't work as expected
Remember to set the bandwidth in Mbps. The following paragraph is part of the chapter 3.2 of the ns2 manual: Bandwidth is specified as a real value, optionally suffixed by a 'k' or 'K' to mean kilo-quantities, or 'm' or 'M' to mean mega-quantities. A final optional suffix of 'B' indicates that the quantity expressed is in Bytes per second. The default is bandwidth expressed in bits per second. For example, all of the following are equivalent: $object set bwvar 1.5m $object set bwvar 1.5mb $object set bwvar 1500k $object set bwvar 1500kb $object set bwvar .1875MB $object set bwvar 187.5kB $object set bwvar 1.5e6 Guillermo Biot Hello, Did you get the answer to your reply? I'm asking because I am also experiencing the same problem with the throughput. Please help me if you have a solution. Also please tell me the version you are using. Mine is ns 2.28. Thanks a lot, Kamil Sandeep-9 wrote: Hi In the below code whatever Mac/802_11 parameters I set are not taking effect. For instance eventhough I set _dataRate 11mbps, throughput is coming around 400kbps, which is the default rate for udp. If I change _dataRate, basicRate_ or PLCPDataRate_ , there is absolutely no effect. Please if anyone can help, because I require them in my work. Thanks in advance, regards, Sandeep. 1 set val(chan) Channel/WirelessChannel;# channel type 2 set val(prop) Propagation/TwoRayGround ;# radio-propagation model 3 set val(netif) Phy/WirelessPhy;# network interface type 4 set val(mac) Mac/802_11 ;# MAC type 5 set val(ifq) Queue/DropTail/PriQueue;# interface queue type 6 set val(ll)LL ;# link layer type 7 set val(ant) Antenna/OmniAntenna;# antenna model 8 set val(ifqlen)50 ;# max packet in ifq 9 set val(nn)2 ;# number of mobilenodes 10 set val(rp)DSDV ;# routing protocol 11 set val(x) 800 12 set val(y) 800 13 14 Phy/WirelessPhy set bandwidth_ 11Mb 15 16 Mac/802_11 set SlotTime_ 0.20;# 20us 17 Mac/802_11 set SIFS_ 0.10;# 10us 18 Mac/802_11 set PreambleLength_144 ;# 144 bit 19 Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits 20 Mac/802_11 set PLCPDataRate_ 1.0 ;# 1Mbps 21 Mac/802_11 set dataRate_ 11.0 ;# 11Mbps 22 Mac/802_11 set basicRate_ 1.0 ;# 1Mbps 23 24 set ns [new Simulator] 25 set tr [open trace.tr w] 26 $ns trace-all $tr 27 set na [open trace.nam w] 28 $ns namtrace-all-wireless $na $val(x) $val(y) 29 set chan1 [new $val(chan)] 30 set topo [new Topography] 31 $topo load_flatgrid 500 500 32 create-god 2 33 34 proc finish {} { 35global ns tr na 36$ns flush-trace 37$ns nam-end-wireless [$ns now] 38close $tr 39close $na 40exec nam trace.nam 41exit 0; 42 } 43 44 $ns node-config -adhocRouting $val(rp)\ 45 -llType $val(ll) \ 46 -macType $val(mac) \ 47 -antType $val(ant) \ 48 -propType $val(prop) \ 49 -phyType $val(netif) \ 50 -channel $chan1 \ 51 -topoInstance $topo \ 52 -agentTrace ON \ 53 -routerTrace ON \ 54 -macTrace ON \ 55 -movementTrace OFF\ 56 -ifqType $val(ifq) \ 57 -ifqLen $val(ifqlen) 58 59 for {set i 0} {$i 2} {incr i} { 60 set node_($i) [$ns node] 61 $node_($i) random-motion 0 62 } 63 64 $node_(0) set X_ 0 65 $node_(0) set Y_ 0 66 $node_(0) set Z_ 0 67 $node_(1) set X_ 10 68 $node_(1) set Y_ 0 69 $node_(1) set Z_ 0 70 71 $node_(0) color green 72 $node_(1) color green 73 74 set udp [new Agent/UDP] 75 set des [new Agent/Null] 76 $ns attach-agent $node_(0) $udp 77 $ns attach-agent $node_(1) $des 78 $ns connect $udp $des 79 80 set udapp [new Application/Traffic/CBR] 81 $udapp attach-agent $udp 82 $udapp set fid_ 1 83 $udapp set packetSize_ 400 84 85 $ns at 1.0 $udapp start 86 $ns at 30.0 $udapp stop 87 $ns at 30.0 $ns halt 88 ns at 30.0 finish 89 $ns run Quoted from: http://www.nabble.com/why-does-the-code-below-doesn%27t-work-as-expected-tf2188094.html#a6053421 Hi Kamil, My problem is solved, there was an error in through calculation, instead of calculating
Re: [ns] setting error rate for two state error model
Yes, with your configuration you will have an average error rate of 5% but in a very particular way. During 0.95 seconds you will receive all the packets correctly and then you will have errors in all packets for 0.05seconds, then again 0.95 seconds of error-free packets and so on... I don't know if that's what you want.
[ns] what is the meaning of $self next
Hi, I'm using some test scripts and I found the following code in one of them: $self next What does it mean? It is part of an instproc. There is no function called next in the script. Thank you. Regards, Guillermo
Re: [ns] How to setup - Random Error Generator in NS2
Hi Aleksandar, In order to generate random errors first you have to create the error model in your script and then attach it to the link or node where you want the packets to be dropped. For creating a random uniformly distributed errors you can type: #Create the error model set em [new ErrorModel] $em unit pkt $em set rate_ 0.03;# PER = 3% $em ranvar [new RandomVariable/Uniform] $em drop-target [new Agent/Null] The way you attach error models to the links is different for wired and wireless scenarios. If you are working with wired scenarios you have different places where you can insert the error model, you can check page 127 of the ns2 manual, I use: #attach the model to the link $ns link-lossmodel $em $n0 $n1 If you are working with wireless scenarios you can attach the error model by adding one option in node-config: $ns_ node-config -incomingErrProc $em or $ns_ node-config -outgoingErrProc $em You can find detailed information of the differences between using the first or the second option also in page 127 of the ns2 manual. I must say that I couldn't use the error models in wireless scenarios. There is some problem with the -incomingErrProc and -outgoingErrProc options, they don't insert the error model in the simulation. In other words, the error model is created but it is never used so no packets are dropped. I have this problem when I use 802.11 it may appear in all kind of wireless scenarios. I asked to this list but I got no answer. Currently I am working in error models of wireless, so if you are also working in wireless I can send you more information on the topic. Regards, Guillermo Hi all, I need to setup link between two nodes where I have RANDOM ERRORS with PER (packet error rate) = 10exp-7, 10exp-6,10exp-5 etc. So, I need to setup Error generator in ns2. Can somebody tell me how to do this? Thanks. A.
[ns] tracing errors in wireless scenario
Hi, I'm running wireless 802.11 simulations in ns-allinone-2.29 and I'm having some problems tracing the errors. When I insert an error model in my tcl script I cannot see any dropped packet in the resulting trace file. I inserted an uniform error model with rate 0.2 (20% of the packets should have errors) using the option incomingErrProc in node-config. I've checked the c++ code that models the errors and I've seen that it doesn't drop the packets, it only marks the packets with the error flag (line 193 of errmodel.cc). Then the mac layer checks if there is an error (line 544 of mac-802_11.cc) and if there is any error calls the function Packet::free(p). This Packet::free function (line 362 of packet.h) has no code, it does nothing. How can I then trace the packets that contain errors? Should I change the c++ code of the function Packet::free() in order to be able to trace these packets? Is there a more simple way to trace them? Thanks, Guillermo
[ns] no packets dropped when using incomingErrProc
Hi, I'm running wireless simulations in ns-2.29. For modeling errors I use the incomingErrProc as an option in node-config. The error model that I use is the uniform error model with a rate of 0.4, but when I check the trace file no packet is dropped. What am I doing wrong? Regards, Guillermo #OPTIONS set val(chan) Channel/WirelessChannel;#Channel Type set val(prop) Propagation/Shadowing ;# 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) 2 ;# number of mobilenodes set val(rp) DSDV ;# routing protocol set val(txpower) 0.1 ;# transmited power in Wats #ERROR MODEL set em [new ErrorModel] $em unit packet $em set rate_ 0.4 $em ranvar [new RandomVariable/Uniform] $em drop-target [new Agent/Null] #NEW TRACE FILE IS USED $ns_ use-newtrace #NODE-CONFIG OPTIONS $ns_ node-config -adhocRouting $val(rp) \ -incomingErrProc $em \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -topoInstance $topo \ -agentTrace OFF \ -routerTrace OFF \ -macTrace ON \ -movementTrace OFF \ -channel $chan_1_ \ -txPower $val(txpower)