Hello Qadous,

I have used the tcl script below to test the error modeling. I am using 
ns-2.29 and when I increase the value of rate_ from 0 to 0.05 I get more 
duplicated packets, and collisions, which is a result of transmission 
errors.


>I used the following command to specify the Error model for mobile node.
>
>$ns_ node-config ErrProc -Incoming ErrProc "Uniform"
>by the way, there is no errors of running the file after these changes.
>thank you in advance for clarification.
>  
>
I think that the right way is this one:

$ns_ node-config ErrProc -IncomingErrProc UniformErr

Here is an example tcl script:

_______________________________________________________________

# Open result files for writing
set tracefd [open ex_2node.tr w]
set namtrace [open ex_2node.nam w]

# Create new simulator instance
set ns_        [new Simulator]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace 1000 1000

# Set up topography object using a flat grid of 1000x1000m
set topo       [new Topography]
$topo load_flatgrid 1000 1000

proc UniformErr {} {
    set err [new ErrorModel]
    $err unit packet
    $err set rate_ 0.05
    $err ranvar [new RandomVariable/Uniform]
    $err drop-target [new Agent/Null]
    return $err
}


# Configure nodes
create-god 2
$ns_ node-config -adhocRouting AODV -topoInstance $topo  -channel [new 
Channel/WirelessChannel] \
    -llType LL -macType Mac/802_11 -ifqType Queue/DropTail/PriQueue 
-ifqLen 50 \
    -antType Antenna/OmniAntenna -propType Propagation/TwoRayGround 
-phyType Phy/WirelessPhy \
    -agentTrace ON  -routerTrace ON  -macTrace ON -movementTrace OFF \
    -IncomingErrProc UniformErr

# create 2 nodes
proc setup_node {id x y z} {
    global ns_ node_
    set node_($id) [$ns_ node]
    $node_($id) set X_ $x
    $node_($id) set Y_ $y
    $node_($id) set Z_ $z
    $node_($id) random-motion 0
    $ns_ initial_node_pos $node_($id) 20
}
setup_node 1 100 200 0
setup_node 2 300 200 0

# start nodes
for {set i 1} {$i < 3} {incr i} {$ns_ at 0 "$node_($i) start";}

# setup UDP traffic node 1 -> 2 using constant bitrate source
set udp(1) [new Agent/UDP]
set sink(1) [new Agent/Null]
set cbr(1) [new Application/Traffic/CBR]
$cbr(1) set class_ 1
$cbr(1) set fid_ 1
$cbr(1) set packetSize_ 500
$cbr(1) set interval_ 0.05
$cbr(1) attach-agent $udp(1)
$ns_ attach-agent $node_(1) $udp(1)
$ns_ attach-agent $node_(2) $sink(1)
$ns_ connect $udp(1) $sink(1)
$ns_ at 1 "$cbr(1) start"

# set stop time, start simulation
for {set i 1} {$i < 3} {incr i} {$ns_ at 1.0 "$node_($i) reset";}
$ns_ at 50.10 "stop"
$ns_ at 50.101 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
    global ns_ tracefd
    $ns_ flush-trace
    close $tracefd
}

# run simulation
$ns_ run

_______________________________________________________________

Best regards,
Svilen

-- 
+------------------------------------------+
| M.Sc. Svilen Ivanov                      |
| Institute for Distributed Systems (IVS)  |
| Otto-von-Guericke University - Magdeburg |
| http://ivs.cs.uni-magdeburg.de/~svilen/  |
+------------------------------------------+

Reply via email to