1

Set error model on link n2 to n3

set loss_module [new ErrorMode] $loss_module set rate_ 0.1

Create the Simulator instance

set ns [new Simulator] $ns color Red $ns color Blue

Open NAM trace file

$set nf [open out.nam w] $ns namtrace-all $nf

Open the Trace file

set tf [open out.tr w] set windowVsTime2 [open WindowVsTimeNReno w] $ns trace-all $tf

Define a 'finish' procedure

proc finish {} { global ns nf tf $ns flush-trace close $nf cose $tf exec nam out.nam & exit 0 }

Create four nodes

set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node]

$ns at 0.1 "n1 label \"CBR\"" $ns at 1.0 "n0 label \"FTP\""

Create links between the nodes

$ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns simplex-link $n2 $n3 0.07Mb 20ms DropTail $ns simplex-link $n3 $n2 0.07Mb 20ms Droptail

Set queue size for link n2-n3 to 10

$ns queue-limit $n2 $n3 10

Moniter the queue for link n2-n3 for NAM

$ns simplex-link op $n2 $n3 queuePos 0.5

Set error model on link n3 to n2

set loss_module [new ErrorModel] $loss_module set rate_ 0.2 $loss_module ranvar [new RandomVariable/Uniform] $loss_module drop-target [new Agent/Null] $ns lossmodel $loss_module $n2 $n3

detach tcp and sink agent

$ns at 624.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"

$ns at 625.0 "finish" $ns run


The error I'm getting after running the above code is as follows:

invalid command name

"ErrorMode"

while executing

"ErrorMode create _o3 "

invoked from within

"catch "$className create $o $args" msg"

invoked from within

"if [catch "$className create $o $args" msg] {

if [string match "__FAILED_SHADOW_OBJECT_" $msg] {

delete $o

return ""

}

global errorInfo

error "class $..."

(procedure "new" line 3)

invoked from within

"new ErrorMode"

invoked from within

"set loss_module [new ErrorMode]"

(file "u.tcl" line 2)
  • This doesn't really seem to be a question about Ubuntu. Are you sure it shouldn't be ErrorModel (rather than ErrorMode)? – steeldriver Oct 11 '15 at 16:10
  • @steeldriver I have tried this (the solution given) but this doesn't seems to be working. – Vishavdeep Oct 11 '15 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.