我一直在尝试通过嘈杂的通道编写TCP连接中的无线电丢弃程序。 我需要帮助解决与编写的程序相关的错误:
(错误消息也写在下面)
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 close $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
ERROR:
----------
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)